forked from StudentCenter/StudentCenter-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
128 lines (121 loc) · 3.34 KB
/
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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import * as React from 'react';
import {createStackNavigator} from '@react-navigation/stack';
import {
NavigationContainer,
DarkTheme as NavigationDarkTheme,
DefaultTheme as NavigationDefaultTheme,
} from '@react-navigation/native';
import {
Provider as PaperProvider,
DefaultTheme as PaperDefaultTheme,
DarkTheme as PaperDarkTheme
} from 'react-native-paper';
import {AuthContext} from './components/context';
import SplashScreen from './Screens/SplashScreen';
import Auth from './Screens/Route/Auth';
import DrawerNavigation from './Screens/Route/DrawerNavigation';
import LandingScreen from './Screens/LandingScreen';
function App() {
const Stack = createStackNavigator();
const [isDarkTheme, setIsDarkTheme] = React.useState(false);
// Default Theme
const CustomDefaultTheme = {
...NavigationDefaultTheme,
...PaperDefaultTheme,
colors: {
...NavigationDefaultTheme.colors,
...PaperDefaultTheme.colors,
background: '#FFFFFF',
text: '#000000',
backgroundmodal: '#FFFFFF',
textinput: '#EEEEEE',
title: '#FFFFFF',
subtitle: '#CFCFCF',
backgroundauth: '#2F80ED',
calendarBackground: '#FFFFFF',
calendarDay: '#333333',
calendarTitle: '#000000',
loader: '#000000',
},
};
// Dark Mode Theme
const CustomDarkModeTheme = {
...NavigationDarkTheme,
...PaperDarkTheme,
colors: {
...NavigationDarkTheme.colors,
...PaperDarkTheme.colors,
background: '#121212',
text: '#FFFFFF',
backgroundmodal: '#2B2B2B',
textinput: '#2B2B2B',
title: '#000000',
subtitle: '#CFCFCF',
backgroundauth: '#000000',
calendarBackground: '#121212',
calendarDay: '#FFFFFF',
calendarTitle: '#FFFFFF',
loader: '#FFFFFF',
},
};
const theme = isDarkTheme ? CustomDarkModeTheme : CustomDefaultTheme;
const authContext = React.useMemo(
() => ({
toggleTheme: () => {
setIsDarkTheme((isDarkTheme) => !isDarkTheme);
},
}),
[],
);
return (
<>
<PaperProvider theme={theme}>
<AuthContext.Provider value={authContext}>
<NavigationContainer theme={theme}>
<Stack.Navigator
initialRouteName='SplashScreen'
>
<Stack.Screen
name='SplashScreen'
component={SplashScreen}
options={{
headerShown: false
}}
/>
<Stack.Screen
name='LandingScreen'
component={LandingScreen}
options={{
headerShown: false,
cardStyle: {backgroundColor: '#2F80ED'}
}}
/>
<Stack.Screen
name='Auth'
component={Auth}
options={{
headerShown: false
}}
/>
<Stack.Screen
name='Landing'
component={DrawerNavigation}
options={{
headerShown: false
}}
/>
</Stack.Navigator>
</NavigationContainer>
</AuthContext.Provider>
</PaperProvider>
</>
);
}
export default App;