| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /**
- * 入口文件
- * @邠心vbe on 2020/05/20
- */
- import React, { Component } from 'react';
- import './app/i18n'
- import {AppRegistry, KeyboardAvoidingView} from 'react-native';
- import codePush from "react-native-code-push";
- 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 'react-native-modals';
- import ModalPortal from './app/components/ModalPortal';
- import {RootSiblingParent} from 'react-native-root-siblings';
- import { SafeAreaView } from 'react-native-safe-area-context';
- import MyStatusBar from './app/components/MyStatusBar';
- import { i18nUtil } from './app/i18n';
- //let context;
- class Index extends Component {
- constructor(props) {
- super(props);
- this.state = {
- visible: false,
- refreshTime: 0
- }
- //context = this;
- }
- componentDidMount() {
- i18nUtil.init(() => {
- this.setState({
- visible: true
- })
- })
- }
- /*restartApp() {
- console.log("----------------RESTART-----------------");
- this.setState({
- visible:false
- }, () => {
- this.setState({
- visible: true
- })
- })
- }*/
- render() {
- return (
- <RootSiblingParent>
- <MyStatusBar/>
- { this.state.visible
- ? isIOS
- ? <KeyboardAvoidingView style={ui.flex1} behavior="padding">
- <Router/>
- </KeyboardAvoidingView>
- : <Router/>
- : <></>
- }
- <ModalPortal />
- <SafeAreaView style={{flex: 0, backgroundColor: colorLight}}></SafeAreaView>
- </RootSiblingParent>
- );
- }
- };
- if (app.codePush) {
- //热更新配置
- let codePushOptions = {
- updateDialog: false,
- //实时检测更新并下载
- checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
- //下载完成后立即安装
- installMode: codePush.InstallMode.IMMEDIATE
- //下次进入安装
- //installMode: codePush.InstallMode.ON_NEXT_RESTART
- };
- AppRegistry.registerComponent(app.name, () => codePush(codePushOptions)(Index));
- } else {
- AppRegistry.registerComponent(app.name, () => Index);
- }
|