This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
60 lines (52 loc) · 1.4 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
import React, { useState } from "react";
import { View } from "react-native";
import { Provider, DefaultTheme, Appbar } from "react-native-paper";
import { ServerSettingsProvider } from './src/components/ServerSettingsContext';
import { RuntimeProvider, VIEW_ENUM } from './src/components/RuntimeContext';
import SettingServerDetails from './src/components/SettingServerDetails';
import WIPAllView from './src/view/Main';
import Top from './src/view/top';
const theme = {
...DefaultTheme,
roundness: 2,
colors: {
...DefaultTheme.colors,
primary: '#3498db',
accent: '#f1c40f',
},
};
const App = () => {
const [appState, setAppState] = useState(VIEW_ENUM.APP);
const AppView = () => {
return (<>
<Top />
<WIPAllView />
</>)
}
const SettingsView = () => {
return (<><Appbar.Header>
<Appbar.BackAction onPress={() => setAppState(VIEW_ENUM.APP)} />
</Appbar.Header>
<SettingServerDetails /></>)
}
const CurrentView = () => {
switch (appState) {
case VIEW_ENUM.APP:
return AppView();
case VIEW_ENUM.SETTINGS:
return SettingsView();
}
}
return (
<Provider theme={theme}>
<RuntimeProvider view={setAppState}>
<ServerSettingsProvider>
<View>
{CurrentView()}
</View>
</ServerSettingsProvider>
</RuntimeProvider>
</Provider>
);
};
export default App;