Skip to content

Instantly share code, notes, and snippets.

@GingerBear
Created March 15, 2017 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GingerBear/022a09632adc8278e3ab9db7c17a5e17 to your computer and use it in GitHub Desktop.
Save GingerBear/022a09632adc8278e3ab9db7c17a5e17 to your computer and use it in GitHub Desktop.
NavigatorIOS push and pop
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Button,
NavigatorIOS
} from 'react-native';
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
return (
<View style={{ flex: 1, margin: 40 }}>
<Text>Hello, Chat App!</Text>
<Button
onPress={() => this.props.navigator.push({
component: HomeScreen,
title: 'Bar That'
})}
title="Chat with Lucy"
/>
</View>
);
}
}
class SimpleApp extends Component {
render() {
return (
<NavigatorIOS
initialRoute={{
component: HomeScreen,
title: 'My Initial Scene',
}}
style={{ flex: 1 }}
/>
);
}
}
AppRegistry.registerComponent('TestReactNavigation', () => SimpleApp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment