-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
61 lines (55 loc) · 1.86 KB
/
App.tsx
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react';
import { StyleSheet, useColorScheme } from 'react-native';
import { StatusBar } from 'expo-status-bar';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Provider as StoreProvider } from 'react-redux';
import styled, { ThemeProvider } from 'styled-components/native';
import { DefaultTheme, NavigationContainer } from '@react-navigation/native';
import AppNavigator from './src/navigations/AppNavigator';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import store from './src/store';
import { NotificationProvider } from './src/contexts/NotificationContext';
import { LightTheme, DarkTheme } from './src/themes';
const App = () => {
const colorScheme = useColorScheme();
const theme = colorScheme === 'dark' ? DarkTheme : LightTheme;
const MyNavigationTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: theme.primary,
},
};
return (
<SafeAreaProvider>
<GestureHandlerRootView style={styles.gesture}>
<ThemeProvider theme={theme}>
<StoreProvider store={store}>
<Container>
<NavigationContainer theme={MyNavigationTheme}>
<NotificationProvider>
<StatusBar
backgroundColor={theme.containerBg}
translucent
style={colorScheme === 'light' ? 'dark' : 'light'}
/>
<AppNavigator />
</NotificationProvider>
</NavigationContainer>
</Container>
</StoreProvider>
</ThemeProvider>
</GestureHandlerRootView>
</SafeAreaProvider>
);
};
export default App;
const Container = styled.View`
flex: 1;
background-color: ${({ theme }) => theme.containerBg};
`;
const styles = StyleSheet.create({
gesture: {
flex: 1,
},
});