Created
March 15, 2017 22:38
-
-
Save GingerBear/022a09632adc8278e3ab9db7c17a5e17 to your computer and use it in GitHub Desktop.
NavigatorIOS push and pop
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
/** | |
* 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