Update Navigation.md
Summary: NavigatorIOS push method arg is route object. For working this image animation, add passProps property to NavigationIOS, changed _onForward function navigator.push method arg is route object <!-- Thank you for sending the PR! If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos! Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native. Happy contributing! --> Closes https://github.com/facebook/react-native/pull/15178 Differential Revision: D5481399 Pulled By: hramos fbshipit-source-id: b131ef27b70fc0bbc4f519a924187c19dca73ed2
This commit is contained in:
parent
f7043699b0
commit
f39f21660d
|
@ -99,6 +99,7 @@ export default class NavigatorIOSApp extends React.Component {
|
|||
initialRoute={{
|
||||
component: MyScene,
|
||||
title: 'My Initial Scene',
|
||||
passProps: {index: 1},
|
||||
}}
|
||||
style={{flex: 1}}
|
||||
/>
|
||||
|
@ -108,7 +109,9 @@ export default class NavigatorIOSApp extends React.Component {
|
|||
|
||||
class MyScene extends React.Component {
|
||||
static propTypes = {
|
||||
title: PropTypes.string.isRequired,
|
||||
route: PropTypes.shape({
|
||||
title: PropTypes.string.isRequired
|
||||
}),
|
||||
navigator: PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
|
@ -116,10 +119,13 @@ class MyScene extends React.Component {
|
|||
super(props, context);
|
||||
this._onForward = this._onForward.bind(this);
|
||||
}
|
||||
|
||||
|
||||
_onForward() {
|
||||
let nextIndex = ++this.props.index;
|
||||
this.props.navigator.push({
|
||||
component: MyScene,
|
||||
title: 'Scene ' + nextIndex,
|
||||
passProps: {index: nextIndex}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue