index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @format
  3. */
  4. import React from 'react';
  5. import {AppRegistry, KeyboardAvoidingView, StatusBar} from 'react-native';
  6. import codePush from "react-native-code-push";
  7. import 'react-native-gesture-handler';
  8. import './app/utils/themes'
  9. import './app/utils/constant';
  10. import './app/utils/notification';
  11. import './app/utils/vector_icon';
  12. import Router from './app/pages/Router';
  13. import {name as appName} from './app.json';
  14. //import {ModalPortal} from 'react-native-modals';
  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. const Index = () => {
  19. return (
  20. <RootSiblingParent>
  21. <StatusBar barStyle={themeStatusBar} backgroundColor={colorPrimaryDark}/>
  22. { isIOS
  23. ? <KeyboardAvoidingView style={ui.flex1} behavior="padding">
  24. <Router />
  25. </KeyboardAvoidingView>
  26. : <Router />
  27. }
  28. <ModalPortal />
  29. <SafeAreaView style={{flex: 0, backgroundColor: colorLight}}></SafeAreaView>
  30. </RootSiblingParent>
  31. );
  32. };
  33. //热更新配置
  34. let codePushOptions = {
  35. updateDialog: true,
  36. //实时检测更新并下载
  37. checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  38. //下载完成后立即安装
  39. //installMode: codePush.InstallMode.IMMEDIATE,
  40. //下次进入安装
  41. //installMode: codePush.InstallMode.ON_NEXT_RESTART
  42. };
  43. AppRegistry.registerComponent(appName, () => codePush(codePushOptions)(Index));
  44. //AppRegistry.registerComponent(appName, () => Index);