Skip to content
Permalink
Browse files

configureScene: add routeStack in second argument

Summary:
Giving routeStack in second parameter of configureScene allows to do more advanced scene configuration.
I have use-case where I can only determine the scene config from the navigation context (not only from the route object but also from where it's located).
Closes #5254

Reviewed By: svcscm

Differential Revision: D2828415

Pulled By: androidtrunkagent

fb-gh-sync-id: 27b6c79b24cbc194e080541e9202ca84c55a0bc4
  • Loading branch information...
gre authored and facebook-github-bot-3 committed Jan 13, 2016
1 parent 0065986 commit 1abd12b68be6358761411272117c830c1afd306a
Showing with 7 additions and 7 deletions.
  1. +7 −7 Libraries/CustomComponents/Navigator/Navigator.js
@@ -189,11 +189,11 @@ var Navigator = React.createClass({
propTypes: {
/**
* Optional function that allows configuration about scene animations and
* gestures. Will be invoked with the route and should return a scene
* configuration object
* gestures. Will be invoked with the route and the routeStack and should
* return a scene configuration object
*
* ```
* (route) => Navigator.SceneConfigs.FloatFromRight
* (route, routeStack) => Navigator.SceneConfigs.FloatFromRight
* ```
*/
configureScene: PropTypes.func,
@@ -293,7 +293,7 @@ var Navigator = React.createClass({
}
return {
sceneConfigStack: routeStack.map(
(route) => this.props.configureScene(route)
(route) => this.props.configureScene(route, routeStack)
),
routeStack,
presentedIndex: initialRouteIndex,
@@ -368,7 +368,7 @@ var Navigator = React.createClass({
this.setState({
routeStack: nextRouteStack,
sceneConfigStack: nextRouteStack.map(
this.props.configureScene
route => this.props.configureScene(route, nextRouteStack)
),
presentedIndex: destIndex,
activeGesture: null,
@@ -913,7 +913,7 @@ var Navigator = React.createClass({
var nextStack = activeStack.concat([route]);
var destIndex = nextStack.length - 1;
var nextAnimationConfigStack = activeAnimationConfigStack.concat([
this.props.configureScene(route),
this.props.configureScene(route, nextStack),
]);
this._emitWillFocus(nextStack[destIndex]);
this.setState({
@@ -981,7 +981,7 @@ var Navigator = React.createClass({
var nextRouteStack = this.state.routeStack.slice();
var nextAnimationModeStack = this.state.sceneConfigStack.slice();
nextRouteStack[index] = route;
nextAnimationModeStack[index] = this.props.configureScene(route);
nextAnimationModeStack[index] = this.props.configureScene(route, nextRouteStack);

if (index === this.state.presentedIndex) {
this._emitWillFocus(route);

0 comments on commit 1abd12b

Please sign in to comment.
You can’t perform that action at this time.