-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
65 lines (53 loc) · 1.61 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
62
63
64
65
import React from 'react';
import { NativeBaseProvider, extendTheme } from 'native-base';
import * as NavigationBar from 'expo-navigation-bar';
import { StatusBar } from 'expo-status-bar';
import { NavigationContainer } from '@react-navigation/native';
import { enableLatestRenderer } from 'react-native-maps';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import shallow from 'zustand/shallow';
import { StackNavigator } from './src/Navigator';
import { useSettingsStore } from './src/stores';
enableLatestRenderer();
export default () => {
const { color } = useSettingsStore(
(state: SettingsState) => ({
color: state.color,
}),
shallow
);
const components = {
View: {
baseStyle: () => ({
backgroundColor: color === '0' ? 'transparent' : 'black',
}),
},
Select: {
baseStyle: {
borderColor: 'cyan.600',
fontColor: 'red.500',
},
},
SelectItem: {
baseStyle: {
color: 'lime',
},
},
};
const theme = extendTheme({ components });
const style = color === '0' ? 'dark' : 'light';
const backgroundColor = color === '0' ? 'transparent' : 'black';
NavigationBar.setButtonStyleAsync(style);
NavigationBar.setBackgroundColorAsync(backgroundColor);
NavigationBar.setBorderColorAsync(backgroundColor);
return (
<NativeBaseProvider theme={theme}>
<StatusBar style={style} backgroundColor={backgroundColor} />
<SafeAreaProvider>
<NavigationContainer>
<StackNavigator />
</NavigationContainer>
</SafeAreaProvider>
</NativeBaseProvider>
);
};