-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
79 lines (67 loc) · 2.08 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
import * as React from 'react';
import {
Provider as PaperProvider,
MD3DarkTheme as DefaultTheme,
BottomNavigation, TouchableRipple
} from 'react-native-paper';
import Home from './src/pages/Home.js';
import Settings from './src/pages/Settings.js';
import Analytics from "./src/pages/Analytics.js";
import List from './src/pages/List.js';
const theme = {
...DefaultTheme,
DarkTheme: true,
mode: "exact",
version: 3,
colors: {
...DefaultTheme.colors,
// light green with dark green bg
primary: "#5bc569",
onPrimary: "#112e15",
primaryContainer: "#112e15",
onPrimaryContainer: "#76e790",
// dark green with bright green bg
secondaryContainer: "#76e790",
onSecondaryContainer: "#112e15",
// yellow with dark yellow bg
tertiaryContainer: "#ecae43",
onTertiaryContainer: "#112e15",
onSurface: "#ccc"
}
}
export default function Main() {
const [settings, setSettings] = React.useState({serverIP: "", serverPort: ""});
const [index, setIndex] = React.useState(0);
const [routes] = React.useState([
{ key: 'home', title: 'Home', focusedIcon: 'home', unfocusedIcon: "home" },
{ key: "list", title: "List", focusedIcon: "format-list-bulleted", unfocusedIcon: "format-list-bulleted" },
{ key: 'settings', title: 'Settings', focusedIcon: 'cog', unfocusedIcon: "cog" },
]);
const renderScene = ({ route }) => {
switch (route.key) {
case 'home':
return <Home settings={settings} setSettings={setSettings} />;
case 'settings':
return <Settings setSettings={setSettings} />;
case 'analytics':
return <Analytics settings={settings} />;
case "list":
return <List settings={settings} />;
default:
return null;
}
}
return (
<PaperProvider theme={theme}>
<BottomNavigation
navigationState={ { index, routes } }
onIndexChange={ setIndex }
renderScene={ renderScene }
compact
labeled={false}
keyboardHidesNavigationBar={true}
sceneAnimationType="shifting"
/>
</PaperProvider>
);
}