Skip to content

Instantly share code, notes, and snippets.

@jemise111
Last active January 20, 2016 19:45
Show Gist options
  • Save jemise111/d4c5b6c8b1d721347eb9 to your computer and use it in GitHub Desktop.
Save jemise111/d4c5b6c8b1d721347eb9 to your computer and use it in GitHub Desktop.
'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