-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathApp.js
31 lines (27 loc) · 871 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import AppNavigation from './app/containers/AppNavigation';
import STORE from './app/store';
import {Provider} from 'react-redux';
import {
getActiveRouteName,
onNavigationStateChange,
} from './app/helpers/NavigationMiddleware';
import {navigationRef} from './app/navigations/RootNavigation';
const App = () => {
const routeNameRef = React.useRef();
React.useEffect(() => {
const state = navigationRef.current.getRootState();
routeNameRef.current = getActiveRouteName(state);
}, []);
return (
<Provider store={STORE}>
<NavigationContainer
ref={navigationRef}
onStateChange={(state) => onNavigationStateChange(state, routeNameRef)}>
<AppNavigation />
</NavigationContainer>
</Provider>
);
};
export default App;