Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. import React from 'react';
  2. import { Button, View, Text } from 'react-native';
  3. import { createStackNavigator, createAppContainer } from 'react-navigation';
  4. import Homelanding from './homelandig';
  5. import { fromLeft, fromRight } from 'react-navigation-transitions';
  6.  
  7. class HomeScreen extends React.Component {
  8. render() {
  9. return (
  10. <Homelanding styleimg={{width: 170 ,height: 170,justifyContent: 'center',}} onPressN={() => this.props.navigation.navigate('Home1')} title="Welcome to Mumtak" text={"With Mumtak you will be able to share moments and places with the Mumtak community.\nLet's learn how to do it together."}/>
  11. );
  12. }
  13. }
  14.  
  15. class H1 extends React.Component {
  16. render() {
  17. return (
  18. <Homelanding styleimg={{width: 300 ,height: 300,justifyContent: 'center',}} onPressB={() => this.props.navigation.goBack()} onPressN={() => this.props.navigation.navigate('Home2')} title="Discover Taks around you" text={"What is a Tak exactly?!\nA Tak is a monument, a friend, a page of your diary, the memory of a moment expressed in Augmented Reality.You will find Taks around you, and you will be able to interact with them, or you can tell a story to the world with a new Tak!"}/>
  19. );
  20. }
  21. }
  22.  
  23. class H2 extends React.Component {
  24. render() {
  25. return (
  26. <Homelanding styleimg={{width: 300 ,height: 300,justifyContent: 'center',}} onPressB={() => this.props.navigation.goBack()} onPressN={() => this.props.navigation.navigate('Welcome')} title="Second test page" text={"That stuff doesn't work well"}/>
  27. );
  28. }
  29. }
  30. const handleCustomTransition = ({ scenes }) => {
  31. const prevScene = scenes[scenes.length - 2];
  32. const nextScene = scenes[scenes.length - 1];
  33.  
  34. // Custom transitions go there
  35. if (prevScene
  36. && prevScene.route.routeName === 'Home1'
  37. && nextScene.route.routeName === 'Welcome'
  38. || prevScene
  39. && prevScene.route.routeName === 'Home2'
  40. && nextScene.route.routeName === 'Home1') {
  41. return fromLeft();
  42. } else
  43. return fromRight();
  44. }
  45.  
  46. const AppNavigator = createStackNavigator(
  47. {
  48. Welcome: {
  49. screen: HomeScreen,
  50. navigationOptions: {
  51. header: null,
  52. }
  53. },
  54. Home1:{
  55. screen: H1,
  56. navigationOptions: {
  57. header: null,
  58. }
  59. },
  60. Home2: {
  61. screen: H2,
  62. navigationOptions: {
  63. header: null,
  64. }
  65. }
  66. },
  67. {
  68. initialRouteName: 'Welcome',
  69. transitionConfig: (nav) => handleCustomTransition(nav),
  70. },
  71. );
  72.  
  73. const AppContainer = createAppContainer(AppNavigator);
  74.  
  75. export default class App extends React.Component {
  76. render() {
  77. return <AppContainer />;
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement