Skip to content

Instantly share code, notes, and snippets.

@dabit3
Last active July 1, 2016 17:02
Show Gist options
  • Save dabit3/80650597b7031c2e2b88c78b68f031cf to your computer and use it in GitHub Desktop.
Save dabit3/80650597b7031c2e2b88c78b68f031cf to your computer and use it in GitHub Desktop.
React Native + MobX index.ios.js or index.android.js
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