Skip to content

Commit

Permalink
pass props (#1549)
Browse files Browse the repository at this point in the history
* pass props

* const

* eslint
  • Loading branch information
indatawetrust authored and aksonov committed Mar 1, 2017
1 parent bef6064 commit baec3ac
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/Reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,35 @@ function inject(state, action, props, scenes) {
case ActionConst.JUMP: {
assert(state.tabs, `Parent=${state.key} is not tab bar, jump action is not valid`);
ind = -1;
state.children.forEach((c, i) => { if (c.sceneKey === action.key) { ind = i; } });

let passProps = false;

state.children.forEach((c, i) => {
if (c.sceneKey === action.key) {
ind = i;

const isPass = state.children.filter(s => s.passProps && s.name === c.sceneKey);

if (isPass.length) {
passProps = true;
}
}
});

assert(ind !== -1, `Cannot find route with key=${action.key} for parent=${state.key}`);

if (action.unmountScenes) {
resetHistoryStack(state.children[ind]);
}

state.children[ind] = getInitialState(
props,
scenes,
state.index,
action,
);
if (passProps) {
state.children[ind] = getInitialState(
props,
scenes,
state.index,
action,
);
}

return { ...state, index: ind };
}
Expand Down

0 comments on commit baec3ac

Please sign in to comment.