Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. import PRSNT_demo from './src/main.js'
  2. import NavAllDay from './src/components/navigation.js';
  3.  
  4. import React, { Component } from 'react';
  5. import { AppRegistry, Text, Navigator, TouchableHighlight } from 'react-native';
  6. import Style from '../Style';
  7.  
  8. console.log('doing this');
  9.  
  10. export default class NavAllDay extends Component {
  11. render() {
  12. const routes = [
  13. {title: 'First Scene', index: 0},
  14. {title: 'Second Scene', index: 1},
  15. ];
  16. return (
  17. <Navigator
  18. style={Style.header}
  19. initialRoute={routes[0]}
  20. renderScene={(route, navigator) =>
  21. <TouchableHighlight onPress={() => {
  22. if (route.index === 0) {
  23. navigator.push(routes[1]);
  24. } else {
  25. navigator.pop();
  26. }
  27. }}>
  28. <Text>Hello {route.title}!</Text>
  29. </TouchableHighlight>
  30. }
  31. navigationBar={
  32. <Navigator.NavigationBar
  33. routeMapper={{
  34. LeftButton: (route, navigator, index, navState) =>
  35. {
  36. if (route.index === 0) {
  37. return null;
  38. } else {
  39. return (
  40. <TouchableHighlight onPress={() => navigator.pop()}>
  41. <Text>Back</Text>
  42. </TouchableHighlight>
  43. );
  44. }
  45. },
  46. RightButton: (route, navigator, index, navState) =>
  47. {
  48. if (route.index === 1) {
  49. return null;
  50. } else {
  51. return (
  52. <TouchableHighlight onPress={() => navigator.push(routes[1])}>
  53.  
  54. <Text>Done</Text>
  55.  
  56. </TouchableHighlight>
  57. );
  58. }
  59. },
  60. Title: (route, navigator, index, navState) =>
  61. { return (<Text>Awesome Nav Bar</Text>); },
  62. }}
  63. style={Style.header}
  64. />
  65. }
  66. />
  67. );
  68. }
  69. }
  70.  
  71. AppRegistry.registerComponent('PRSNT_demo', () => NavAllDay)
  72.  
  73. import React, { Component } from 'react';
  74. import Style from './Style';
  75.  
  76. import {
  77. AppRegistry,
  78. Text,
  79. View
  80. } from 'react-native';
  81.  
  82. export default class PRSNT_demo extends Component {
  83. render() {
  84. return (
  85. <View style={Style.container}>
  86.  
  87. <View style={Style.invites}>
  88. <Text style={Style.presentListText}> Section</Text>
  89. </View>
  90. <View style={Style.presentList}>
  91. <Text style={Style.presentListText}>
  92. List
  93. </Text>
  94. </View>
  95. </View>
  96. );
  97. }
  98. }
  99.  
  100. AppRegistry.registerComponent('PRSNT_demo', () => PRSNT_demo);
  101.  
  102. import React, { Component } from 'react';
  103. import {
  104. AppRegistry,
  105. View
  106. } from 'react-native';
  107.  
  108. import PRSNT_demo from './src/main.js'
  109. import NavAllDay from './src/components/navigation.js'
  110.  
  111. export default class Main extends Component {
  112. render() {
  113. return (
  114. <View>
  115. <PRSNT_demo />
  116. <NavAllDay />
  117. </View>
  118. )
  119. }
  120. }
  121.  
  122. AppRegistry.registerComponent('PRSNT_demo', () => Main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement