Last active
July 1, 2016 17:02
-
-
Save dabit3/80650597b7031c2e2b88c78b68f031cf to your computer and use it in GitHub Desktop.
React Native + MobX index.ios.js or index.android.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import App from './app/App' | |
import ListStore from './app/mobx/listStore' | |
import { | |
AppRegistry, | |
Navigator | |
} from 'react-native' | |
class ReactNativeMobX extends Component { | |
renderScene (route, navigator) { | |
return <route.component {...route.passProps} navigator={navigator} /> | |
} | |
configureScene (route, routeStack) { | |
if (route.type === 'Modal') { | |
return Navigator.SceneConfigs.FloatFromBottom | |
} | |
return Navigator.SceneConfigs.PushFromRight | |
} | |
render () { | |
return ( | |
<Navigator | |
configureScene={this.configureScene.bind(this)} | |
renderScene={this.renderScene.bind(this)} | |
initialRoute={{ | |
component: App, | |
passProps: { | |
store: ListStore | |
} | |
}} /> | |
) | |
} | |
} | |
AppRegistry.registerComponent('ReactNativeMobX', () => ReactNativeMobX) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment