Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import {
- StyleSheet,
- Text,
- View,
- TouchableOpacity,
- } from 'react-native';
- import {createStackNavigator} from 'react-navigation';
- class FristScreen extends React.Component{
- static navigationOptions = { header: null}
- render(){
- const {navigate} = this.props.navigation;
- return(
- <View>
- //when you press text you will navigate to second page...
- <Text onPress={() => navigate("Second")>First page...</Text>
- </View>
- );
- };
- }//end
- class SecondScreen extends React.Component{
- static navigationOptions = { header: null}
- render(){
- const {navigate} = this.props.navigation;
- return(
- <View>
- //when you press text you will return/navigate to first page...
- <Text onPress={() => navigate("Frist")}>Second page...</Text>
- </View>
- );
- };
- }//end
- const NavigationApp = createStackNavigator(
- {
- First: {screen: FirstScreen},
- Second: {screen: SecondScreen},
- }
- );
- export default class App extends React.Component {
- render() {
- return <NavigationApp/>;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement