-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
75 lines (69 loc) · 2.72 KB
/
App.js
File metadata and controls
75 lines (69 loc) · 2.72 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
/*
App.js
*/
import React, { useState, useEffect } from "react"
import { View } from "react-native"
import Start from "./src/tabs/start/index"
import Home from "./src/tabs/home/index"
import History from "./src/tabs/history/index"
import Settings from "./src/tabs/settings/index"
import { NavigationContainer } from "@react-navigation/native"
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome"
import { faHome, faHistory, faCog } from "@fortawesome/free-solid-svg-icons"
import { initialize } from "./src/scripts/storage"
import { screen, colors } from "./src/constants"
const App = () => {
let [initialized, setInitialized] = useState(false)
useEffect(() => {
if(!initialized){
initialize(() => {
setInitialized(true)
})
}
}, [initialized])
const Tab = createBottomTabNavigator()
return initialized && (
<NavigationContainer>
<Tab.Navigator initialRouteName={"Start"} lazy={false} tabBarOptions={{
showLabel: false,
style: {
height: Math.max(screen.bottom + 60, 80),
backgroundColor: colors.darkPurple,
borderTopWidth: 0
},
tabStyle: {
height: Math.max(60 + screen.bottom, 80),
paddingTop: 5,
paddingBottom: screen.bottom
},
activeBackgroundColor: colors.extraDarkPurple,
inactiveTintColor: colors.lightPurple,
activeTintColor: colors.extraLightPurple
}} screenOptions={({route}) => {
return {
tabBarIcon: ({color}) => {
let icon
if(route.name == "Home"){
icon = faHome
} else if(route.name == "History"){
icon = faHistory
} else {
icon = faCog
}
return <FontAwesomeIcon icon={icon} size={32} color={color} />
}
}
}}>
<Tab.Screen name={"Start"} options={{
tabBarVisible: false,
tabBarButton: () => <View style={{ display: "none" }} />
}} component={Start} />
<Tab.Screen name={"Home"} component={Home}/>
<Tab.Screen name={"History"} component={History}/>
<Tab.Screen name={"Settings"} component={Settings}/>
</Tab.Navigator>
</NavigationContainer>
)
}
export default App