index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * 入口文件
  3. * @邠心vbe on 2020/05/20
  4. */
  5. import React, { Component } from 'react';
  6. import './app/i18n'
  7. import {AppRegistry} from 'react-native';
  8. import 'react-native-gesture-handler';
  9. import './app/utils/themes'
  10. import './app/utils/constant';
  11. import './app/utils/notification';
  12. import './app/utils/vector_icon';
  13. import Router from './app/pages/Router';
  14. import app from './app.json';
  15. import ModalPortal from './app/components/ModalPortal';
  16. import {RootSiblingParent} from 'react-native-root-siblings';
  17. import { SafeAreaView } from 'react-native-safe-area-context';
  18. import MyStatusBar from './app/components/MyStatusBar';
  19. import { i18nUtil } from './app/i18n';
  20. import RouterV2 from './app/pages/RouterV2';
  21. class Index extends Component {
  22. constructor(props) {
  23. super(props);
  24. this.state = {
  25. visible: false,
  26. refreshTime: 0
  27. }
  28. }
  29. componentDidMount() {
  30. i18nUtil.init(() => {
  31. this.setState({
  32. visible: true
  33. })
  34. })
  35. }
  36. render() {
  37. return (
  38. <RootSiblingParent>
  39. <MyStatusBar/>
  40. { this.state.visible
  41. ? (app.isLumiWhitelabel ? <RouterV2/> : <Router/>)
  42. : <></>
  43. }
  44. <ModalPortal />
  45. { isIOS && (
  46. <SafeAreaView style={{flex: 0, backgroundColor: colorLight}}></SafeAreaView>)
  47. }
  48. </RootSiblingParent>
  49. );
  50. }
  51. };
  52. AppRegistry.registerComponent(app.name, () => Index);