App.tsx
1.42 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, { useLayoutEffect, useEffect } from 'react'
import { StatusBar, Platform, Text, TextInput } from 'react-native'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { RouterView } from './src/router'
import { Provider } from 'react-redux'
import { PrivacyAlert } from './src/components'
import { PortalHot, Update } from 'react-native-mb-ui'
import { getVersionCode } from './src/libs/utils'
import { APP } from './src/config'
import SplashScreen from 'react-native-splash-screen'
import store from './src/store'
//阻止系统缩放
TextInput.defaultProps = Object.assign({}, TextInput.defaultProps, { allowFontScaling: false })
Text.defaultProps = Object.assign({}, Text.defaultProps, { allowFontScaling: false })
const Page = () => {
useLayoutEffect(() => {
SplashScreen.hide()
}, [])
useEffect(() => {
(async () => Update(`${APP.appAdminUrl}/api/app/version/${APP.APP_CODE}`, await getVersionCode()))()
}, [])
return (
<Provider store={store}>
{Platform.OS === 'ios' && <StatusBar translucent={true} backgroundColor="rgba(255,255,255,0)" barStyle="dark-content" />}
<PortalHot>
<SafeAreaProvider>
<RouterView />
<PrivacyAlert />
</SafeAreaProvider>
</PortalHot>
</Provider>
)
}
export default Page