Skip to content

Commit 6d2e5d1

Browse files
author
Pavlo Aksonov
committed
avoid scene modificaiton for cloned scenes
1 parent fee8981 commit 6d2e5d1

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-router-flux",
3-
"version": "3.2.2",
3+
"version": "3.2.3",
44
"description": "React Native Router using Flux architecture",
55
"repository": {
66
"type": "git",

src/Reducer.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function inject(state, action, props, scenes) {
3838
props.key = state.key;
3939
return {...state, ...props};
4040
case PUSH_ACTION:
41-
if (state.children[state.index].sceneKey == action.key){
41+
if (state.children[state.index].sceneKey == action.key && !props.clone){
4242
return state;
4343
}
4444
return {...state, index:state.index+1, children:[...state.children, getInitialState(props, scenes, state.index + 1, action)]};
@@ -116,11 +116,8 @@ function reducer({initialState, scenes}){
116116
assert(scene, "missed route data for key="+action.key);
117117

118118
// clone scene
119-
if (action.type === PUSH_ACTION && scene.clone) {
120-
let uniqKey = `${_uniqPush++}$${scene.key}`;
121-
let clone = {...scene, key: uniqKey, sceneKey: uniqKey, parent: getCurrent(state).parent};
122-
state.scenes[uniqKey] = clone;
123-
action.key = uniqKey;
119+
if (scene.clone) {
120+
action.parent = getCurrent(state).parent;
124121
}
125122

126123
} else {
@@ -141,11 +138,6 @@ function reducer({initialState, scenes}){
141138
action.parent = el.sceneKey;
142139
}
143140

144-
// remove if clone
145-
if (action.clone && action.sceneKey && (action.type === POP_ACTION || action.type === POP_ACTION2)) {
146-
delete state.scenes[action.sceneKey];
147-
}
148-
149141
}
150142
switch (action.type) {
151143
case POP_ACTION2:

0 commit comments

Comments
 (0)