Skip to content

Commit ef57c3f

Browse files
committed
1.7.1
1 parent a3eccb4 commit ef57c3f

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ In the render function return
2020
levelPage={1}
2121
transitionIn={
2222
animatioPageIn:"fadeInRight"
23-
,animatioPageOut:"fadeOutRight"
23+
,animatioPageOut:"fadeOutLeft"
2424
}
2525
transitionOut={{
26-
animatioPageOut: "fadeOutRight"
26+
animatioPageOut: "fadeOutLeft"
2727
}}
2828
/>
2929
@@ -47,7 +47,7 @@ this.navigatorRef.changePage(
4747
```
4848

4949
```
50-
options = { animatioPageIn:"fadeInLeft" // have defult
50+
options = { animatioPageIn:"fadeInRight" // have defult
5151
, animationPageOut:"fadeOutLeft" // have defult
5252
, timeAnimationInMS:integer // defult=250(ms)
5353
, callbackFun:function

dist/index.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ var Navigator = function (_React$Component) {
112112
_this.changePage = _this.changePage.bind(_this);
113113

114114
if (Array.isArray(_this.props.children)) _this.props.children.map(function (child) {
115-
if (child.key === null || child.key === "") window.console.log("react.cordova-navigation_controller: key value it's required");
115+
if (child.key === null || child.key === "") window.console.log("navigation_controller: key value it's required");
116116
});
117117
return _this;
118118
}
@@ -208,6 +208,16 @@ var Navigator = function (_React$Component) {
208208
value: function changePage(goToPage, options) {
209209
var _this3 = this;
210210

211+
var fthis = this;
212+
213+
this.props.children.forEach(function (child) {
214+
if (child.props.kill) {
215+
fthis.historyPages = fthis.historyPages.filter(function (x) {
216+
return x !== child.key;
217+
});
218+
}
219+
});
220+
211221
this.setState({ historyPages: this.historyPages });
212222

213223
var fromPage = "" + this.historyPages[this.historyPages.length - 1] + "";
@@ -248,7 +258,7 @@ var Navigator = function (_React$Component) {
248258
} else {}
249259

250260
if (!this.busy) {
251-
var fthis = this;
261+
// const fthis = this;
252262

253263
//--animation time defult
254264
var timeAnimation = timeAnimationInMS; //param.timeAnimationInMS !== undefined && param.timeAnimationInMS !== null ? param.timeAnimationInMS :
@@ -379,7 +389,7 @@ var Navigator = function (_React$Component) {
379389

380390
return _react2.default.createElement("div", null);
381391
} else {
382-
return _react2.default.createElement(
392+
return nowPage === child.key || fthis.state.historyPages.includes(child.key) || child.props.alwaysLive ? _react2.default.createElement(
383393
"div",
384394
{
385395
// onTouchStart={(e) => {
@@ -444,8 +454,8 @@ var Navigator = function (_React$Component) {
444454
key: child.key,
445455
className: fthis.state.startPage === child.key ? "showPage scrollPage" : "hiddenPage"
446456
},
447-
nowPage === child.key || fthis.state.historyPages.includes(child.key) || child.props.alwaysLive ? _react2.default.cloneElement(child, fthis.state.props[child.key], child.props.children) : _react2.default.createElement("div", null)
448-
);
457+
_react2.default.cloneElement(child, fthis.state.props[child.key], child.props.children)
458+
) : null;
449459
}
450460
}) : _react2.default.createElement(
451461
"div",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react.cordova-navigation_controller",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "Navigator for Cordova with React.js(react.cordova), This will help you to manage your pages history in the app and change pages with animation.",
55
"main": "dist/index.js",
66
"scripts": {

src/index.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ export default class Navigator extends React.Component {
114114
if (Array.isArray(this.props.children))
115115
this.props.children.map((child) => {
116116
if (child.key === null || child.key === "")
117-
window.console.log(
118-
"react.cordova-navigation_controller: key value it's required"
119-
);
117+
window.console.log("navigation_controller: key value it's required");
120118
});
121119
}
122120

@@ -226,6 +224,14 @@ export default class Navigator extends React.Component {
226224
}
227225

228226
changePage(goToPage, options) {
227+
const fthis = this;
228+
229+
this.props.children.forEach((child) => {
230+
if (child.props.kill) {
231+
fthis.historyPages = fthis.historyPages.filter((x) => x !== child.key);
232+
}
233+
});
234+
229235
this.setState({ historyPages: this.historyPages });
230236

231237
const fromPage = "" + this.historyPages[this.historyPages.length - 1] + "";
@@ -271,7 +277,7 @@ export default class Navigator extends React.Component {
271277
}
272278

273279
if (!this.busy) {
274-
const fthis = this;
280+
// const fthis = this;
275281

276282
//--animation time defult
277283
const timeAnimation = timeAnimationInMS; //param.timeAnimationInMS !== undefined && param.timeAnimationInMS !== null ? param.timeAnimationInMS :
@@ -453,7 +459,9 @@ export default class Navigator extends React.Component {
453459

454460
return <div></div>;
455461
} else {
456-
return (
462+
return nowPage === child.key ||
463+
fthis.state.historyPages.includes(child.key) ||
464+
child.props.alwaysLive ? (
457465
<div
458466
// onTouchStart={(e) => {
459467

@@ -541,19 +549,13 @@ export default class Navigator extends React.Component {
541549
: "hiddenPage"
542550
}
543551
>
544-
{nowPage === child.key ||
545-
fthis.state.historyPages.includes(child.key) ||
546-
child.props.alwaysLive ? (
547-
React.cloneElement(
548-
child,
549-
fthis.state.props[child.key],
550-
child.props.children
551-
)
552-
) : (
553-
<div />
552+
{React.cloneElement(
553+
child,
554+
fthis.state.props[child.key],
555+
child.props.children
554556
)}
555557
</div>
556-
);
558+
) : null;
557559
}
558560
})
559561
) : (

0 commit comments

Comments
 (0)