-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
68 lines (57 loc) · 1.86 KB
/
App.js
File metadata and controls
68 lines (57 loc) · 1.86 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
import { NavigationContainer } from "@react-navigation/native";
import React, { useEffect, useState } from "react";
import { StyleSheet, useColorScheme } from "react-native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import Home from "./App/Screens/Home";
import Stats from "./App/Screens/Stats";
import Settings from "./App/Screens/Settings";
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
import { faTint, faSignal, faCog } from "@fortawesome/free-solid-svg-icons";
const Tab = createBottomTabNavigator();
const App = () => {
const styles = StyleSheet.create({
light: {
backgroundColor: 'white',
color: 'black'
},
dark: {
backgroundColor: 'black',
color: 'white'
},
})
const isDarkMode = useColorScheme() === 'dark';
const [style, setStyle] = useState(isDarkMode ? styles.light : styles.dark)
useEffect(() => {
setStyle(isDarkMode ? styles.dark : styles.light)
}, [isDarkMode])
return (
<NavigationContainer>
<Tab.Navigator
screenOptions={{
tabBarStyle: style,
headerShown: false,
}}
>
<Tab.Screen name="Home" component={Home} options={{
tabBarIcon: ({ color, size }) => (
<FontAwesomeIcon icon={ faTint } color={color} size={size} />
)
}
}/>
<Tab.Screen name="Stats" component={Stats} options={{
tabBarIcon: ({ color, size }) => (
<FontAwesomeIcon icon={ faSignal } color={color} size={size} />
)
}
} />
<Tab.Screen name="Settings" component={Settings} options={{
tabBarIcon: ({ color, size }) => (
<FontAwesomeIcon icon={ faCog } color={color} size={size} />
)
}
}/>
</Tab.Navigator>
</NavigationContainer>
);
}
export default App;