import React, { Component } from 'react'; import { Provider } from 'react-redux'; import { PersistGate } from 'redux-persist/integration/react'; import { BackHandler, } from 'react-native'; import { Loading } from '../components'; import { navigation } from '../tools'; import { Navigation } from '../tools/navigation'; interface RootProps { store: any; persistor: any; } class Root extends Component { backHandler: () => boolean; constructor(props) { super(props); Navigation.setStore(props.store); this.backHandler = navigation.backAction; } componentDidMount() { BackHandler.addEventListener('hardwareBackPress', this.backHandler); } componentWillUnmount() { BackHandler.removeEventListener('hardwareBackPress', this.backHandler); } render() { const { store, persistor } = this.props; return ( } persistor={persistor}> {this.props.children} ); } } export default Root;