Skip to content

Commit 35802ee

Browse files
committed
Merged branch master into vanvobr
2 parents bb00f06 + db34e37 commit 35802ee

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

CustomScreen.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import {
77

88

99
export 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
}

IntialScreen.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff 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} />}

index.android.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { Component } from 'react';
22
import styles from './style';
33
import NavigationBar from 'react-native-navbar';
4-
import IntialScreen from './IntialScreen'
4+
import IntialScreen from './IntialScreen';
5+
import CustomScreen from './CustomScreen';
56
import {
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

1817
export 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
);

0 commit comments

Comments
 (0)