Last active
January 20, 2016 19:45
-
-
Save jemise111/d4c5b6c8b1d721347eb9 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
import React from 'react-native'; | |
// Views | |
import SwiftView from './Views/SwiftView'; | |
import ObjectiveCView from './Views/ObjectiveCView'; | |
const { | |
AppRegistry, | |
Navigator, | |
StyleSheet, | |
Text, | |
View | |
} = React; | |
const RouteStack = { | |
routeNameObjectiveCView : ObjectiveCView, | |
routeNameSwiftView : SwiftView | |
}; | |
class ReactNativeExample extends React.Component { | |
renderScene(route, navigator) { | |
const Component = route.component; | |
return <Component navigator={navigator} {...route.props} />; | |
} | |
render() { | |
const component = RouteStack[this.props.route]; | |
const props = this.props; | |
return ( | |
<View style={styles.container}> | |
<Navigator | |
ref='navigator' | |
initialRoute={{component, props}} | |
renderScene={this.renderScene.bind(this)} | |
/> | |
</View> | |
); | |
} | |
} | |
var styles = StyleSheet.create({ | |
container: { | |
flex: 1 | |
} | |
}); | |
AppRegistry.registerComponent('ReactNativeExample', () => ReactNativeExample); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment