|
1 | 1 | import { useContext, memo, useEffect } from 'react'; |
2 | 2 | import { NavigationContainer } from '@react-navigation/native'; |
3 | 3 | import { createNativeStackNavigator } from '@react-navigation/native-stack'; |
4 | | -import { connect } from 'react-redux'; |
5 | 4 |
|
6 | 5 | import type { SetUsernameStackParamList, StackParamList } from './definitions/navigationTypes'; |
7 | 6 | import Navigation from './lib/navigation/appNavigation'; |
| 7 | +import { useMasterDetail } from './lib/hooks/useMasterDetail'; |
| 8 | +import { useAppSelector } from './lib/hooks/useAppSelector'; |
8 | 9 | import { defaultHeader, getActiveRouteName, navigationTheme } from './lib/methods/helpers/navigation'; |
9 | 10 | import { RootEnum } from './definitions'; |
10 | 11 | // Stacks |
@@ -33,8 +34,10 @@ const SetUsernameStack = () => ( |
33 | 34 |
|
34 | 35 | // App |
35 | 36 | const Stack = createStackNavigator<StackParamList>(); |
36 | | -const App = memo(({ root, isMasterDetail }: { root: string; isMasterDetail: boolean }) => { |
| 37 | +const App = memo(() => { |
37 | 38 | const { theme } = useContext(ThemeContext); |
| 39 | + const isMasterDetail = useMasterDetail(); |
| 40 | + const root = useAppSelector(state => state.app.root); |
38 | 41 |
|
39 | 42 | useEffect(() => { |
40 | 43 | if (root) { |
@@ -87,10 +90,4 @@ const App = memo(({ root, isMasterDetail }: { root: string; isMasterDetail: bool |
87 | 90 | </> |
88 | 91 | ); |
89 | 92 | }); |
90 | | -const mapStateToProps = (state: any) => ({ |
91 | | - root: state.app.root, |
92 | | - isMasterDetail: state.app.isMasterDetail |
93 | | -}); |
94 | | - |
95 | | -const AppContainer = connect(mapStateToProps)(App); |
96 | | -export default AppContainer; |
| 93 | +export default App; |
0 commit comments