forked from zingolabs/zingo-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
151 lines (139 loc) · 3.92 KB
/
Copy pathApp.tsx
File metadata and controls
151 lines (139 loc) · 3.92 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* eslint-disable react-native/no-inline-styles */
import React, { useState } from 'react';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import { DefaultTheme, NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { LoadedApp } from './app/LoadedApp';
import { LoadingApp } from './app/LoadingApp';
import { ThemeType, RootStackParamList } from './app/types';
import { ModeEnum, RouteEnums } from './app/AppState';
import { LogBox, StatusBar } from 'react-native';
LogBox.ignoreLogs(['[Reanimated] Reduced motion setting is enabled on this device.']);
const advancePalette: string[] = [
'#06172d',
'#dadfe1',
'#43a637',
'#23692f',
'#656e77',
'#183f24',
'#444b56',
'#37444e',
'#7c8494',
'#041d09',
'#040C17',
];
const basicPalette: string[] = [
'#07182e',
'#dadfe1',
'#15576f',
'#4fa254',
'#14343f',
'#123a53',
'#1e6531',
'#84848a',
'#444b54',
'#60849c',
'#040C17',
];
const advancedTheme: ThemeType = {
...DefaultTheme,
dark: true,
colors: {
background: advancePalette[0],
card: advancePalette[0],
border: advancePalette[8],
primary: advancePalette[2],
primaryDisabled: advancePalette[3],
secondary: '#112C51',
secondaryDisabled: advancePalette[5],
secondaryBorder: '#293D55',
tertiary: '#033679',
text: advancePalette[1],
zingo: advancePalette[8],
placeholder: advancePalette[8],
money: advancePalette[1],
syncing: '#ebff5a', // yellow
notification: '',
sideMenuBackground: advancePalette[10],
warning: {
background: '#262527',
border: '#65491C',
primary: '#F99D00',
primaryDark: '#DD7500',
title: '#E1AA1B',
text: '#FEE587',
},
danger: {
primary: '#dc2626',
background: '#240E0C',
border: '#572317',
text: '#FFB972',
},
modal: '#1e293b',
},
};
const basicTheme: ThemeType = {
...DefaultTheme,
dark: true,
colors: {
background: basicPalette[0],
card: basicPalette[0],
border: basicPalette[7],
primary: basicPalette[9],
primaryDisabled: basicPalette[2],
secondaryDisabled: basicPalette[5],
text: basicPalette[1],
zingo: basicPalette[7],
placeholder: basicPalette[7],
money: basicPalette[1],
syncing: '#ebff5a', // yellow
notification: '',
sideMenuBackground: basicPalette[10],
warning: {
background: '#262527',
border: '#65491C',
primary: '#F99D00',
primaryDark: '#DD7500',
title: '#E1AA1B',
text: '#FEE587',
},
danger: {
background: '#240E0C',
border: '#572317',
text: '#FFB972',
},
modal: '#1e293b',
},
};
const Stack = createStackNavigator<RootStackParamList>();
const App: React.FunctionComponent = () => {
const [theme, setTheme] = useState<ThemeType>(advancedTheme);
const toggleTheme = (mode: ModeEnum) => {
setTheme(mode === ModeEnum.advanced ? advancedTheme : basicTheme);
};
//console.log('render App - 1');
return (
<SafeAreaProvider>
<StatusBar backgroundColor={theme.colors.background} />
<NavigationContainer theme={theme}>
<SafeAreaView
style={{
flex: 1,
backgroundColor: theme.colors.background,
}}>
<Stack.Navigator
initialRouteName={RouteEnums.LoadingApp}
screenOptions={{ headerShown: false, animation: 'none' }}>
<Stack.Screen name={RouteEnums.LoadingApp} options={{ animation: 'none' }}>
{props => <LoadingApp {...props} toggleTheme={toggleTheme} />}
</Stack.Screen>
<Stack.Screen name={RouteEnums.LoadedApp} options={{ animation: 'none' }}>
{props => <LoadedApp {...props} toggleTheme={toggleTheme} />}
</Stack.Screen>
</Stack.Navigator>
</SafeAreaView>
</NavigationContainer>
</SafeAreaProvider>
);
};
export default App;