Skip to content

Commit a5b2f5b

Browse files
committed
Fix lint rule "no-shadow" and "no-param-reassign"
1 parent ba1ee5f commit a5b2f5b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

index.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ class Router extends React.Component {
4646
}
4747
}
4848

49-
onForward(route, navigator) {
50-
route.index = this.state.route.index + 1 || 1;
51-
navigator.push(route);
49+
onForward(nextRoute, navigator) {
50+
navigator.push(
51+
Object.assign(nextRoute, { index: this.state.route.index + 1 || 1 })
52+
);
5253
}
5354

5455
setRightProps(props) {
@@ -72,19 +73,22 @@ class Router extends React.Component {
7273
}
7374

7475
renderScene(route, navigator) {
75-
const goForward = function goForward(route) {
76-
route.index = this.state.route.index + 1 || 1;
77-
navigator.push(route);
76+
const goForward = function goForward(nextRoute) {
77+
navigator.push(
78+
Object.assign(nextRoute, { index: this.state.route.index + 1 || 1 })
79+
);
7880
}.bind(this);
7981

80-
const replaceRoute = function replaceRoute(route) {
81-
route.index = this.state.route.index || 0;
82-
navigator.replace(route);
82+
const replaceRoute = function replaceRoute(nextRoute) {
83+
navigator.replace(
84+
Object.assign(nextRoute, { index: this.state.route.index || 0 })
85+
);
8386
}.bind(this);
8487

85-
const resetToRoute = function resetToRoute(route) {
86-
route.index = 0;
87-
navigator.resetTo(route);
88+
const resetToRoute = function resetToRoute(nextRoute) {
89+
navigator.resetTo(
90+
Object.assign(nextRoute, { index: 0 })
91+
);
8892
};
8993

9094
const goBackwards = function goBackwards() {

0 commit comments

Comments
 (0)