File tree Expand file tree Collapse file tree 3 files changed +29
-14
lines changed Expand file tree Collapse file tree 3 files changed +29
-14
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ import {
77
88
99export default class CustomScreen extends Component {
10+ constructor ( props ) {
11+ super ( props ) ;
12+ console . log ( "CustomScreen contructor " , this . props . feedId ) ;
13+ }
1014 render ( ) {
1115 const leftButtonConfig = {
1216 title : 'Back' ,
@@ -18,6 +22,7 @@ export default class CustomScreen extends Component {
1822 < NavigationBar
1923 title = { { title : 'Custom screen' , } }
2024 leftButton = { leftButtonConfig } />
25+ < Text > { this . props . name . title } </ Text >
2126 </ View >
2227 ) ;
2328 }
Original file line number Diff line number Diff line change @@ -132,12 +132,21 @@ export default class InitialScreen extends Component {
132132 return (
133133 < TouchableHighlight onPress = { ( ) => {
134134 highlightRow ( sectionID , rowID ) ;
135+ this . props . navigator . push ( {
136+ name : 'CustomScreen' , // Matches route.name
137+ passProps : {
138+ name : feed
139+ }
140+ } )
141+
135142 } } >
143+
144+
145+
136146 < View >
137147 < View style = { styles . initview . row } >
138148 < Image style = { styles . initview . thumb } source = { { uri : feed . thumb } } />
139149 < View style = { styles . initview . text } >
140-
141150 < Text style = { styles . initview . description } > { feed . title } </ Text >
142151 </ View >
143152 </ View >
@@ -165,20 +174,13 @@ export default class InitialScreen extends Component {
165174 } ;
166175
167176 render ( ) {
168- const rightButtonConfig = {
169- title : 'Forward ',
170- handler : ( ) = > this . props . navigator . push ( {
171- component : CustomScreen ,
172- } ) ,
173- } ;
174177
175178 if ( this . state . isLoading ) {
176179 return this . renderLoadingView ( ) ;
177180 } ;
178181
179-
180-
181182 return (
183+
182184 < View >
183185 < ListView
184186 renderScrollComponent = { props => < InfiniteScrollView { ...props } /> }
Original file line number Diff line number Diff line change 11import React , { Component } from 'react' ;
22import styles from './style' ;
33import NavigationBar from 'react-native-navbar' ;
4- import IntialScreen from './IntialScreen'
4+ import IntialScreen from './IntialScreen' ;
5+ import CustomScreen from './CustomScreen' ;
56import {
67 AppRegistry ,
78 Text ,
@@ -11,19 +12,26 @@ import {
1112} from 'react-native' ;
1213
1314
14- function renderScene ( route , navigator ) {
15- return < route . component route = { route } navigator = { navigator } /> ;
16- }
15+
1716
1817export default class AwesomeProject extends Component {
1918
19+ renderScene ( route , navigator ) {
20+ if ( route . name == 'IntialScreen' ) {
21+ return < IntialScreen navigator = { navigator } { ...route . passProps } />
22+ }
23+ if ( route . name == 'CustomScreen' ) {
24+ return < CustomScreen navigator = { navigator } { ...route . passProps } />
25+ }
26+ }
27+
2028 render ( ) {
2129 const initialRoute = {
2230 component : IntialScreen
2331 }
2432 return (
2533 < View style = { { flex : 1 , backgroundColor : '#ff9900' , } } >
26- < Navigator initialRoute = { initialRoute } renderScene = { renderScene } />
34+ < Navigator initialRoute = { { name : 'IntialScreen' } } renderScene = { this . renderScene } />
2735
2836 </ View >
2937 ) ;
You can’t perform that action at this time.
0 commit comments