| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /**
- * 入口文件
- * @邠心vbe on 2020/05/20
- */
- import React, { Component } from 'react';
- import './app/i18n'
- import {AppRegistry, View} from 'react-native';
- import 'react-native-gesture-handler';
- import './app/utils/themes'
- import './app/utils/constant';
- import './app/utils/notification';
- import './app/utils/vector_icon';
- import Router from './app/pages/Router';
- import app from './app.json';
- import ModalPortal from './app/components/ModalPortal';
- import {RootSiblingParent} from 'react-native-root-siblings';
- import { SafeAreaInsetsContext, SafeAreaProvider } from 'react-native-safe-area-context';
- import MyStatusBar from './app/components/MyStatusBar';
- import { i18nUtil } from './app/i18n';
- import RouterV2 from './app/pages/RouterV2';
- class Index extends Component {
- constructor(props) {
- super(props);
- this.state = {
- visible: false,
- refreshTime: 0,
- navBottom: undefined
- }
- }
- componentDidMount() {
- i18nUtil.init(() => {
- this.setState({
- visible: true
- })
- })
- }
- init(insets) {
- console.log("insets" + this.state.navBottom, insets)
- if (this.state.navBottom == undefined) {
- if (insets.top) {
- global.statusHeight = insets.top
- }
- if (insets.bottom != undefined) {
- global.navbarHeight = insets.bottom
- this.setState({
- navBottom: insets.bottom
- })
- }
- }
- }
- render() {
- return (
- <SafeAreaProvider>
- <RootSiblingParent>
- <MyStatusBar/>
- { this.state.visible
- ? (app.isLumiWhitelabel ? <RouterV2/> : <Router/>)
- : <></>
- }
- <ModalPortal/>
- { this.state.navBottom != undefined
- ? <View style={{height: isIOS ? 0 : this.state.navBottom, backgroundColor: colorAccent}}></View>
- : <SafeAreaInsetsContext.Consumer>
- {insets => this.init(insets)}
- </SafeAreaInsetsContext.Consumer>
- }
- </RootSiblingParent>
- </SafeAreaProvider>
- );
- }
- };
- AppRegistry.registerComponent(app.name, () => Index);
|