-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
100 lines (95 loc) · 3.96 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
import * as React from 'react';
import { Dimensions, StatusBar } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import { CardStyleInterpolators, createStackNavigator } from '@react-navigation/stack';
import { DarkModeProvider, useDarkMode } from 'react-native-dark-mode';
import changeNavigationBarColor from 'react-native-navigation-bar-color';
import Material from 'react-native-vector-icons/FontAwesome5';
import Ionicons from 'react-native-vector-icons/Ionicons';
import Home from './src/screens/Home';
import Settings from './src/screens/Settings';
import global from './src/styles/global';
import Splash from './src/screens/Splash';
import Login from './src/screens/Login';
import SignUp from './src/screens/Signup';
import PhoneNumber from './src/screens/PhoneNumber';
import EditProfile from './src/screens/EditProfile';
import Policies from './src/screens/Policies';
const Stack = createStackNavigator();
function HomeScreen() {
return (
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} options={{ headerShown: false }} />
</Stack.Navigator>
);
}
function SettingsScreen() {
return (
<Stack.Navigator>
<Stack.Screen name="Settings" component={Settings} options={{ headerShown: false }} />
<Stack.Screen name="PhoneNumber" component={PhoneNumber} options={{ headerShown: false }} />
<Stack.Screen name="EditProfile" component={EditProfile} options={{ headerShown: false }} />
<Stack.Screen name="Policies" component={Policies} options={{ headerShown: false }} />
</Stack.Navigator>
);
}
function TabStack() {
return (
<Tab.Navigator
tabBarOptions={{
showIcon: true,
showLabel: false,
style: { backgroundColor: useDarkMode() ? 'black' : 'white' },
activeTintColor: global.accent.color,
inactiveTintColor: global.accent_muted.color,
indicatorStyle: { backgroundColor: global.accent.color },
}}
tabBarPosition={'bottom'}
initialLayout={{ width: Dimensions.get('window').width, height: Dimensions.get('window').height }}>
<Tab.Screen name="HomeStack" component={HomeScreen} options={{
tabBarIcon: ({ focused, color }) => {
let iconName;
iconName = focused
? 'temperature-high'
: 'temperature-low';
return <Material name={iconName} size={height / 20} color={color} />;
},
}} />
<Tab.Screen name="SettingStack" component={SettingsScreen} options={{
tabBarIcon: ({ focused, color }) => {
let iconName;
iconName = focused ? 'md-settings-sharp' : 'md-settings-outline';
return <Ionicons name={iconName} size={height / 20} color={color} />;
},
}} />
</Tab.Navigator>
);
}
const Tab = createMaterialTopTabNavigator();
const height = Dimensions.get('window').width;
// eslint-disable-next-line no-undef
export default App = () => {
changeNavigationBarColor(useDarkMode() ? 'black' : 'white', !useDarkMode());
return (
<DarkModeProvider>
<NavigationContainer>
<StatusBar
barStyle={useDarkMode() ? 'light-content' : 'dark-content'}
backgroundColor={useDarkMode() ? 'black' : 'white'}
/>
<Stack.Navigator
screenOptions={{
cardStyleInterpolator: CardStyleInterpolators.forVerticalIOS,
}}
>
<Stack.Screen name="Splash" component={Splash} options={{ headerShown: false }} />
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
<Stack.Screen name="Signup" component={SignUp} options={{ headerShown: false }} />
<Stack.Screen name="Tabs" component={TabStack} options={{ headerShown: false }} />
<Stack.Screen name="Policy" component={Policies} options={{ headerShown: false }} />
</Stack.Navigator>
</NavigationContainer>
</DarkModeProvider>
);
};