-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
62 lines (57 loc) · 1.85 KB
/
App.tsx
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React, {Suspense, lazy} from 'react';
import {StyleProp, View, ViewStyle} from 'react-native';
import Home from './src/pages/Home';
const Hisui = lazy(() => import('./src/pages/Hisui'));
const Paldea = lazy(() => import('./src/pages/Paldea'));
const Kitakami = lazy(() => import('./src/pages/Kitakami'));
const Blueberry = lazy(() => import('./src/pages/Blueberry'));
const Sandwich = lazy(() => import('./src/pages/Sandwich'));
import {globalColor} from './src/globalStyle';
import {observer} from '@quarkunlimit/qu-mobx';
import {Provider, useStore} from './src/globalStore/index';
import {LoadingModal} from './src/layout/LoadingModal';
import {EPage} from './src/interface';
import {ToolBar} from './src/components/ToolBar';
import {QText} from './src/components/QText';
const backgroundStyle: StyleProp<ViewStyle> = {
backgroundColor: globalColor.background,
flex: 1,
};
const App = observer(function App_(): React.JSX.Element {
const global = useStore();
const {logic} = global;
return (
<View style={backgroundStyle}>
<LoadingModal />
<View style={{flex: 1}}>
<Suspense
fallback={
<View>
<QText>页面加载中...</QText>
</View>
}>
{logic.currentPage === EPage.Home && <Home />}
{logic.currentPage === EPage.Hisui && <Hisui />}
{logic.currentPage === EPage.Paldea && <Paldea />}
{logic.currentPage === EPage.Kitakami && <Kitakami />}
{logic.currentPage === EPage.Blueberry && <Blueberry />}
{logic.currentPage === EPage.Sandwich && <Sandwich />}
</Suspense>
</View>
<ToolBar />
</View>
);
});
export default observer(function Root() {
return (
<Provider>
<App />
</Provider>
);
});