index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. class Index extends Component {
  21. constructor(props) {
  22. super(props);
  23. this.state = {
  24. visible: false,
  25. refreshTime: 0
  26. }
  27. }
  28. componentDidMount() {
  29. i18nUtil.init(() => {
  30. this.setState({
  31. visible: true
  32. })
  33. })
  34. }
  35. render() {
  36. return (
  37. <RootSiblingParent>
  38. <MyStatusBar/>
  39. { this.state.visible
  40. ? <Router/>
  41. : <></>
  42. }
  43. <ModalPortal />
  44. { isIOS && (
  45. <SafeAreaView style={{flex: 0, backgroundColor: colorLight}}></SafeAreaView>)
  46. }
  47. </RootSiblingParent>
  48. );
  49. }
  50. };
  51. AppRegistry.registerComponent(app.name, () => Index);