Skip to content

Commit 946d81c

Browse files
committed
1.7.3
1 parent 9b4e918 commit 946d81c

File tree

4 files changed

+70
-27
lines changed

4 files changed

+70
-27
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
It's manager for your pages like mobile app.<br>
66

7+
<br/><br/>
8+
9+
I dedicate a considerable amount of my free time to developing and maintaining this plugin, along with my other Open Source software. To help ensure this Cli is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes.
10+
11+
<a href="https://paypal.me/orchoban">
12+
<img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG_global.gif" width="200px" alt=""/>
13+
</a>
14+
15+
<br/>
16+
717
#### `import Navigator from 'react.cordova-navigation_controller';`
818

919
<br>
@@ -120,7 +130,7 @@ options = { animatioPageIn:"fadeInRight" // have defult
120130
<td>string</td>
121131
<td>optional</td>
122132
<td>The key of the first child</td>
123-
<td>(nowPageKey,levelAction) => { ... }</td>
133+
<td></td>
124134
</tr>
125135
</tbody>
126136
</table>
@@ -170,8 +180,14 @@ options = { animatioPageIn:"fadeInRight" // have defult
170180
<tr>
171181
<td>transitionIn</td>
172182
<td>json:{ animatioPageIn:string
173-
,animatioPageOut:string
174-
,animationTimeInMS:integer}</td>
183+
,animatioPageOut:string}</td>
184+
<td>optional</td>
185+
<td>-</td>
186+
<td></td>
187+
</tr>
188+
<tr>
189+
<td>animationTimeInMS</td>
190+
<td>integer</td>
175191
<td>optional</td>
176192
<td>-</td>
177193
<td></td>

dist/index.js

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ var Navigator = function (_React$Component) {
110110
_this.props.onRef(_this);
111111

112112
_this.changePage = _this.changePage.bind(_this);
113+
_this.back = _this.back.bind(_this);
114+
_this.funAnimationIn1 = _this.funAnimationIn1.bind(_this);
115+
_this.funAnimationIn2 = _this.funAnimationIn2.bind(_this);
116+
_this.funAnimationOut1 = _this.funAnimationOut1.bind(_this);
117+
_this.funAnimationOut2 = _this.funAnimationOut2.bind(_this);
118+
_this.compareTwoPagesLavel = _this.compareTwoPagesLavel.bind(_this);
113119

114120
if (Array.isArray(_this.props.children)) _this.props.children.map(function (child) {
115121
if (child.key === null || child.key === "") window.console.log("navigation_controller: key value it's required");
@@ -223,12 +229,11 @@ var Navigator = function (_React$Component) {
223229
var fromPage = "" + this.historyPages[this.historyPages.length - 1] + "";
224230

225231
var aniTime = 250;
232+
226233
if (this.props.children.filter(function (x) {
227234
return x.key === goToPage;
228-
}).length > 0) {
229-
if (this.props.children.filter(function (x) {
230-
return x.key === goToPage;
231-
})[0].props.animationTimeInMS) aniTime = this.props.children.filter(function (x) {
235+
})[0].props.animationTimeInMS) {
236+
aniTime = this.props.children.filter(function (x) {
232237
return x.key === goToPage;
233238
})[0].props.animationTimeInMS;
234239
} else {
@@ -241,11 +246,11 @@ var Navigator = function (_React$Component) {
241246
_options$props = _options.props,
242247
props = _options$props === undefined ? null : _options$props,
243248
_options$animationIn = _options.animationIn,
244-
animationIn = _options$animationIn === undefined ? this.componentTransitionIn[goToPage] ? this.componentTransitionIn[goToPage].animatioPageIn ? this.componentTransitionIn[goToPage].animatioPageIn : null : null : _options$animationIn,
249+
animationIn = _options$animationIn === undefined ? this.componentTransitionIn[goToPage] ? this.componentTransitionIn[goToPage] : null : _options$animationIn,
245250
_options$timeAnimatio = _options.timeAnimationInMS,
246251
timeAnimationInMS = _options$timeAnimatio === undefined ? aniTime : _options$timeAnimatio,
247252
_options$animationOut = _options.animationOut,
248-
animationOut = _options$animationOut === undefined ? this.swipeRight ? "slideOutRight" : this.componentTransitionOut[fromPage] ? this.componentTransitionOut[fromPage].animatioPageOut ? this.componentTransitionOut[fromPage].animatioPageOut : null : null : _options$animationOut,
253+
animationOut = _options$animationOut === undefined ? this.swipeRight ? "slideOutRight" : this.componentTransitionOut[fromPage] ? this.componentTransitionOut[fromPage] : null : _options$animationOut,
249254
_options$callbackFun = _options.callbackFun,
250255
callbackFun = _options$callbackFun === undefined ? null : _options$callbackFun;
251256

@@ -353,6 +358,18 @@ var Navigator = function (_React$Component) {
353358
}, {
354359
key: "back",
355360
value: function back(options) {
361+
var _this4 = this;
362+
363+
this.props.children.forEach(function (child) {
364+
if (child.props.kill) {
365+
_this4.historyPages = _this4.historyPages.filter(function (x) {
366+
return x !== child.key;
367+
});
368+
}
369+
});
370+
this.setState({ historyPages: this.historyPages });
371+
372+
//---
356373
if (options === null || options === undefined) {
357374
this.changePage(this.state.historyPages[this.state.historyPages.length - 2]);
358375
} else {
@@ -362,7 +379,7 @@ var Navigator = function (_React$Component) {
362379
}, {
363380
key: "render",
364381
value: function render() {
365-
var _this4 = this;
382+
var _this5 = this;
366383

367384
var fthis = this;
368385
// window.navigation_controller = this;
@@ -403,7 +420,7 @@ var Navigator = function (_React$Component) {
403420
fthis.swipeRight = true;
404421
fthis.setState({ swipeRightStart_x: e.touches[0].clientX });
405422

406-
var goToPage = _this4.state.historyPages[_this4.state.historyPages.length - 2];
423+
var goToPage = _this5.state.historyPages[_this5.state.historyPages.length - 2];
407424

408425
(0, _jquery2.default)("#" + goToPage).css("z-index", 0);
409426
(0, _jquery2.default)("#" + nowPage).css("z-index", 89);
@@ -418,7 +435,7 @@ var Navigator = function (_React$Component) {
418435
}
419436
},
420437
onTouchEnd: function onTouchEnd(e) {
421-
var goToPage = _this4.state.historyPages[_this4.state.historyPages.length - 2];
438+
var goToPage = _this5.state.historyPages[_this5.state.historyPages.length - 2];
422439

423440
if (fthis.swipeRight && fthis.state.swipeRight_x > 0.25 * innerWidth) {
424441
fthis.callbackFunOnChangePage = function () {
@@ -448,7 +465,7 @@ var Navigator = function (_React$Component) {
448465
style: {
449466
left: fthis.swipeRight ? fthis.touchBackPage === child.key ? fthis.state.swipeRight_x : "" : "",
450467
backgroundColor: child.props.backgroundColor ? child.props.backgroundColor : "#fff",
451-
height: child.props.height ? child.props.height : fthis.props.height ? _this4.props.height : "100%"
468+
height: child.props.height ? child.props.height : fthis.props.height ? _this5.props.height : "100%"
452469
},
453470
id: child.key,
454471
key: child.key,

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.2",
3+
"version": "1.7.3",
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: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ export default class Navigator extends React.Component {
110110
this.props.onRef(this);
111111

112112
this.changePage = this.changePage.bind(this);
113+
this.back = this.back.bind(this);
114+
this.funAnimationIn1 = this.funAnimationIn1.bind(this);
115+
this.funAnimationIn2 = this.funAnimationIn2.bind(this);
116+
this.funAnimationOut1 = this.funAnimationOut1.bind(this);
117+
this.funAnimationOut2 = this.funAnimationOut2.bind(this);
118+
this.compareTwoPagesLavel = this.compareTwoPagesLavel.bind(this);
113119

114120
if (Array.isArray(this.props.children))
115121
this.props.children.map((child) => {
@@ -237,13 +243,13 @@ export default class Navigator extends React.Component {
237243
const fromPage = "" + this.historyPages[this.historyPages.length - 1] + "";
238244

239245
let aniTime = 250;
240-
if (this.props.children.filter((x) => x.key === goToPage).length > 0) {
241-
if (
242-
this.props.children.filter((x) => x.key === goToPage)[0].props
243-
.animationTimeInMS
244-
)
245-
aniTime = this.props.children.filter((x) => x.key === goToPage)[0].props
246-
.animationTimeInMS;
246+
247+
if (
248+
this.props.children.filter((x) => x.key === goToPage)[0].props
249+
.animationTimeInMS
250+
) {
251+
aniTime = this.props.children.filter((x) => x.key === goToPage)[0].props
252+
.animationTimeInMS;
247253
} else {
248254
if (this.props.animationTimeInMS) aniTime = this.props.animationTimeInMS;
249255
}
@@ -253,17 +259,13 @@ export default class Navigator extends React.Component {
253259
const {
254260
props = null,
255261
animationIn = this.componentTransitionIn[goToPage]
256-
? this.componentTransitionIn[goToPage].animatioPageIn
257-
? this.componentTransitionIn[goToPage].animatioPageIn
258-
: null
262+
? this.componentTransitionIn[goToPage]
259263
: null,
260264
timeAnimationInMS = aniTime,
261265
animationOut = this.swipeRight
262266
? "slideOutRight"
263267
: this.componentTransitionOut[fromPage]
264-
? this.componentTransitionOut[fromPage].animatioPageOut
265-
? this.componentTransitionOut[fromPage].animatioPageOut
266-
: null
268+
? this.componentTransitionOut[fromPage]
267269
: null,
268270
callbackFun = null,
269271
} = options;
@@ -420,6 +422,14 @@ export default class Navigator extends React.Component {
420422
}
421423

422424
back(options) {
425+
this.props.children.forEach((child) => {
426+
if (child.props.kill) {
427+
this.historyPages = this.historyPages.filter((x) => x !== child.key);
428+
}
429+
});
430+
this.setState({ historyPages: this.historyPages });
431+
432+
//---
423433
if (options === null || options === undefined) {
424434
this.changePage(
425435
this.state.historyPages[this.state.historyPages.length - 2]

0 commit comments

Comments
 (0)