Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import App from './components/Home';
  3. import {
  4. AppRegistry,
  5. View
  6. } from 'react-native';
  7.  
  8. export default class myapp extends Component {
  9. render() {
  10. return (
  11. <App />
  12. );
  13. }
  14. }
  15.  
  16.  
  17. AppRegistry.registerComponent('myapp', () => myapp);
  18.  
  19. import React, { Component } from 'react';
  20. import {StackNavigator} from 'react-navigation';
  21. import Regions from './Regions';
  22. import Compatibility from './Compatibility';
  23.  
  24. import {
  25. AppRegistry,
  26. StyleSheet,
  27. Text,
  28. View,
  29. Linking
  30. } from 'react-native';
  31.  
  32. class Home extends Component {
  33. static navigationOptions = {
  34. title: 'Login',
  35. headerStyle: {
  36. backgroundColor:'#000000'
  37. },
  38. headerTitleStyle: {
  39. color:'#fff'
  40. }
  41. };
  42. render(){
  43. const {navigate} = this.props.navigation;
  44. return (
  45. <View style={styles.container}>
  46. <Text style={styles.instructions} onPress={()=>navigate('Regions',{realm:'blah'})}>
  47. Regions
  48. </Text>
  49. </View>
  50. );
  51. }
  52. }
  53.  
  54. const styles = StyleSheet.create({
  55. container: {
  56. flex: 1,
  57. justifyContent: 'center',
  58. alignItems: 'center',
  59. backgroundColor: '#F5FCFF',
  60. },
  61.  
  62. instructions: {
  63. textAlign: 'center',
  64. color: '#333333',
  65. marginBottom: 5,
  66. },
  67. });
  68.  
  69.  
  70. const myscreens = StackNavigator({
  71. Home: {screen: Home},
  72. Regions:{screen:Regions},
  73. Compatibility:{screen:Compatibility}
  74. });
  75.  
  76. export default myscreens;
  77.  
  78. import React, { Component } from 'react';
  79. import {StackNavigator} from 'react-navigation';
  80.  
  81. import {
  82. Text,
  83. View,
  84. FlatList
  85. } from 'react-native';
  86.  
  87. export default class Regions extends Component {
  88. static navigationOptions = {
  89. title: 'Pick Region',
  90. headerStyle: {
  91. backgroundColor:'#F00'
  92. },
  93. headerTitleStyle: {
  94. color:'#fff'
  95. },
  96. headerTruncatedBackTitle:{
  97. color:'#fff'
  98. },
  99. headerBackTitle:{
  100. color:'#fff'
  101. },
  102. headerBackTitleStyle:{
  103. color:'#fff'
  104. },
  105. headerTruncatedBackTitle:{
  106. color:'#fff'
  107. }
  108. };
  109. constructor(props)
  110. {
  111. super(props);
  112. }
  113. render() {
  114.  
  115.  
  116. const {navigate} = this.props.navigation;
  117.  
  118. let data = [
  119. {regionName:'General',numOfDimensions:2}
  120. ];
  121.  
  122. return (
  123. <FlatList
  124. data={data}
  125. keyExtractor={(item, index) => index}
  126. renderItem={({item}) => <Text onPress={()=>navigate('Compatibility',{item:item})}>{item.regionName}</Text>}
  127. />
  128. );
  129.  
  130. }
  131. }
  132.  
  133. import React, { Component } from 'react';
  134.  
  135. import {
  136. Text,
  137. View,
  138. FlatList
  139. } from 'react-native';
  140.  
  141. export default class Compatibility extends Component {
  142. static navigationOptions = {
  143. title: 'Pick Region',
  144. headerStyle: {
  145. backgroundColor:'#F00'
  146. },
  147. headerTitleStyle: {
  148. color:'#fff'
  149. },
  150. headerTruncatedBackTitle:{
  151. color:'#fff'
  152. },
  153. headerBackTitle:{
  154. color:'#fff'
  155. },
  156. headerBackTitleStyle:{
  157. color:'#fff'
  158. },
  159. headerTruncatedBackTitle:{
  160. color:'#fff'
  161. }
  162. };
  163.  
  164. constructor(props)
  165. {
  166. super(props);
  167. }
  168.  
  169. render() {
  170.  
  171. console.log('Compatibility');
  172. return <View></View>;
  173. }
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement