UNPKG

react-native-embryo

Version:

- [x] Bugfree Xcode & Android setups for multiple build flavors - [x] [React Native Navigation](https://github.com/wix/react-native-navigation) - [x] [MobX](https://github.com/mobxjs/mobx) - [x] Friendly exception handling (no crash :dizzy_face:) - [x] Ce

39 lines (33 loc) 953 B
// @flow import * as React from 'react' import { View } from 'react-native' import { Navigation } from 'react-native-navigation' import ErrorBoundary from './components/ErrorBoundary' import screens from './screens' import { screenIds, animationTypes } from './constants' type navigationProps = { navigator: Object, }; Object.keys(screens).forEach((id: string) => { const Screen = screens[id] const Wrapper = (props: navigationProps) => ( <View style={{ flex: 1, backgroundColor: '#fff' }}> <ErrorBoundary> <Screen navigator={props.navigator} /> </ErrorBoundary> </View> ) Wrapper.navigatorStyle = Object.assign({}, Screen.navigatorStyle) Navigation.registerComponent(id, () => Wrapper) }) export const startApp = () => { Navigation.startSingleScreenApp({ screen: { screen: screenIds.HOME, }, animationType: animationTypes.FADE, }) } // start the app startApp() export default startApp