-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
171 lines (159 loc) · 4.77 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import 'react-native-gesture-handler';
import React from 'react';
import {PersistGate} from 'redux-persist/es/integration/react';
import {Provider} from 'react-redux';
import {store, persistor} from './src/store';
import {Platform, StatusBar} from 'react-native';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import Routine from './src/screens/RoutineList';
import Exercise from './src/screens/Exercise';
import Home from './src/screens/Home';
import Settings from './src/screens/Settings';
import RoutinePlaylist from './src/screens/RoutinePlaylist';
import CompleteExercise from './src/screens/CompleteExercise';
import screenNames from './src/constants/navigation';
import Icon from 'react-native-vector-icons/MaterialIcons';
import colors from './src/constants/colors';
import Splash from './src/screens/Splash';
import UserContainer from './src/screens/UserContainer';
import ListExercise from './src/screens/ExerciseLibrary';
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from 'react-native-responsive-screen';
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const iconSize = 30;
const App = () => {
return (
<>
{Platform.OS === 'android' ? (
<StatusBar
backgroundColor={colors.solidWhite}
barStyle="dark-content"
/>
) : null}
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<SafeAreaProvider style={{flex: 1}}>
<NavigationContainer>
<HomeStack />
</NavigationContainer>
</SafeAreaProvider>
</PersistGate>
</Provider>
</>
);
};
const HomeStack = () => {
return (
<Stack.Navigator
screenOptions={{headerShown: false}}
initialRouteName={screenNames.SPLASH_SCREEN}>
<Stack.Screen name={screenNames.SPLASH_SCREEN} component={Splash} />
<Stack.Screen
name={screenNames.USER_CONTAINER}
component={UserContainer}
/>
<Stack.Screen
name={screenNames.HOME}
component={TabNav}
options={Platform.OS === 'ios' ? {gestureEnabled: false} : {}}
/>
<Stack.Screen name={screenNames.ROUTINE} component={Routine} />
<Stack.Screen name={screenNames.EXERCISE} component={Exercise} />
<Stack.Screen
name={screenNames.EXERCISE_COMPLETED}
component={CompleteExercise}
/>
<Stack.Screen
name={screenNames.ROUTINEPLAYLIST}
component={RoutinePlaylist}
/>
</Stack.Navigator>
);
};
const TabNav = () => {
return (
<Tab.Navigator
tabBarOptions={{
style: {
height: Platform.OS === 'android' ? hp('7%') : hp('8.2%'),
backgroundColor: colors.secondary_container,
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
},
}}>
<Tab.Screen
name={screenNames.HOME}
component={Home}
options={{
tabBarLabel: '',
tabBarOptions: {
activeTintColor: colors.app_Tint,
},
tabBarIcon: (tabInfo) => {
return (
<Icon
name="home-filled"
size={iconSize}
color={
tabInfo.focused ? colors.app_Tint : colors.app_color_secondary
}
style={{top: 10}}
/>
);
},
}}
/>
<Tab.Screen
name={screenNames.LIST_EXERCISE}
component={ListExercise}
options={{
tabBarLabel: '',
tabBarOptions: {
activeTintColor: colors.app_Tint,
},
tabBarIcon: (tabInfo) => {
return (
<Icon
name="format-list-bulleted"
size={iconSize}
color={
tabInfo.focused ? colors.app_Tint : colors.app_color_secondary
}
style={{top: 10}}
/>
);
},
}}
/>
<Tab.Screen
name={screenNames.SETTINGS}
component={Settings}
options={{
tabBarLabel: '',
tabBarOptions: {
activeTintColor: colors.app_Tint,
},
tabBarIcon: (tabInfo) => {
return (
<Icon
name="settings"
size={iconSize}
color={
tabInfo.focused ? colors.app_Tint : colors.app_color_secondary
}
style={{top: 10}}
/>
);
},
}}
/>
</Tab.Navigator>
);
};
export default App;