Advertisement
Guest User

App.js

a guest
May 17th, 2018
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import React from 'react';
  2. import {
  3. StyleSheet,
  4. Text,
  5. View,
  6. TouchableOpacity,
  7. } from 'react-native';
  8.  
  9. import {createStackNavigator} from 'react-navigation';
  10.  
  11. class FristScreen extends React.Component{
  12. static navigationOptions = { header: null}
  13. render(){
  14. const {navigate} = this.props.navigation;
  15. return(
  16. <View>
  17. //when you press text you will navigate to second page...
  18. <Text onPress={() => navigate("Second")>First page...</Text>
  19. </View>
  20. );
  21. };
  22. }//end
  23.  
  24.  
  25. class SecondScreen extends React.Component{
  26. static navigationOptions = { header: null}
  27. render(){
  28. const {navigate} = this.props.navigation;
  29. return(
  30. <View>
  31. //when you press text you will return/navigate to first page...
  32. <Text onPress={() => navigate("Frist")}>Second page...</Text>
  33. </View>
  34. );
  35. };
  36. }//end
  37.  
  38.  
  39. const NavigationApp = createStackNavigator(
  40. {
  41. First: {screen: FirstScreen},
  42. Second: {screen: SecondScreen},
  43. }
  44. );
  45.  
  46. export default class App extends React.Component {
  47. render() {
  48. return <NavigationApp/>;
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement