Created
March 28, 2019 19:19
-
-
Save rocksinghajay/99ef704da9865e60399801c8957918f8 to your computer and use it in GitHub Desktop.
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
| import React from 'react' | |
| import { View, Text, Button } from 'react-native' | |
| import { createAppContainer, createStackNavigator } from 'react-navigation' | |
| class HomeScreen extends React.Component { | |
| render() { | |
| return ( | |
| <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> | |
| <Text>Home Screen</Text> | |
| <Button | |
| title="Go to Details" | |
| onPress={() => { | |
| this.props.navigation.navigate('Details') | |
| }} | |
| /> | |
| </View> | |
| ); | |
| } | |
| } | |
| class DetailsScreen extends React.Component { | |
| render() { | |
| return ( | |
| <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> | |
| <Text>Details Screen</Text> | |
| <Button | |
| title="Go to Home" | |
| onPress={() => { | |
| this.props.navigation.navigate('Home') | |
| }} | |
| /> | |
| </View> | |
| ); | |
| } | |
| } | |
| const AppNavigator = createStackNavigator({ | |
| Home: { | |
| screen: HomeScreen, | |
| }, | |
| Details: { | |
| screen: DetailsScreen, | |
| }, | |
| }, { | |
| initialRouteName: 'Home', | |
| }); | |
| export default createAppContainer(AppNavigator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment