forked from czy0729/Bangumi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
executable file
·50 lines (44 loc) · 1.41 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
/*
* @Author: czy0729
* @Date: 2019-03-30 19:25:19
* @Last Modified by: czy0729
* @Last Modified time: 2022-06-30 00:44:03
*/
import React, { useEffect } from 'react'
import { LogBox } from 'react-native'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import Provider from '@ant-design/react-native/lib/provider'
import Stacks from '@src/navigations'
import { DeepLink, NavigationContainer, DEV } from '@components'
import { HoldMenuProvider } from '@components/@/react-native-hold-menu'
import { AppCommon } from '@_'
import { _ } from '@stores'
import { useCachedResources, useOrientation, useGlobalMount } from '@utils/hooks'
import theme from '@styles/theme'
LogBox.ignoreAllLogs(true)
export default function App() {
// 加载图标等资源
const isLoadingComplete = useCachedResources()
// 获取水平状态, 只有平板允许横屏, 手机锁竖屏
const orientation = useOrientation()
useEffect(() => {
_.toggleOrientation(orientation)
}, [orientation])
// App启动稳定后统一做的操作
useGlobalMount()
if (!isLoadingComplete) return null
return (
<SafeAreaProvider style={_.container.flex}>
<Provider theme={theme}>
<HoldMenuProvider>
<NavigationContainer>
<Stacks />
</NavigationContainer>
</HoldMenuProvider>
<DeepLink />
<AppCommon />
</Provider>
<DEV />
</SafeAreaProvider>
)
}