@@ -143,20 +143,6 @@ type Event = Object;
143
143
* });
144
144
* ```
145
145
*
146
- * A navigation object contains the following functions:
147
- *
148
- * - `push(route)` - Navigate forward to a new route
149
- * - `pop()` - Go back one page
150
- * - `popN(n)` - Go back N pages at once. When N=1, behavior matches `pop()`
151
- * - `replace(route)` - Replace the route for the current page and immediately
152
- * load the view for the new route
153
- * - `replacePrevious(route)` - Replace the route/view for the previous page
154
- * - `replacePreviousAndPop(route)` - Replaces the previous route/view and
155
- * transitions back to it
156
- * - `resetTo(route)` - Replaces the top item and popToTop
157
- * - `popToRoute(route)` - Go back to the item for a particular route object
158
- * - `popToTop()` - Go back to the top item
159
- *
160
146
* Navigator functions are also available on the NavigatorIOS component:
161
147
*
162
148
* ```
@@ -492,6 +478,9 @@ var NavigatorIOS = React.createClass({
492
478
this . navigationContext . emit ( 'willfocus' , { route : route } ) ;
493
479
} ,
494
480
481
+ /**
482
+ * Navigate forward to a new route
483
+ */
495
484
push : function ( route : Route ) {
496
485
invariant ( ! ! route , 'Must supply route to push' ) ;
497
486
// Make sure all previous requests are caught up first. Otherwise reject.
@@ -514,6 +503,9 @@ var NavigatorIOS = React.createClass({
514
503
}
515
504
} ,
516
505
506
+ /**
507
+ * Go back N pages at once. When N=1, behavior matches `pop()`
508
+ */
517
509
popN : function ( n : number ) {
518
510
if ( n === 0 ) {
519
511
return ;
@@ -535,6 +527,9 @@ var NavigatorIOS = React.createClass({
535
527
}
536
528
} ,
537
529
530
+ /**
531
+ * Go back one page
532
+ */
538
533
pop : function ( ) {
539
534
this . popN ( 1 ) ;
540
535
} ,
@@ -574,23 +569,30 @@ var NavigatorIOS = React.createClass({
574
569
} ,
575
570
576
571
/**
577
- * Replaces the top of the navigation stack.
572
+ * Replace the route for the current page and immediately
573
+ * load the view for the new route.
578
574
*/
579
575
replace : function ( route : Route ) {
580
576
this . replaceAtIndex ( route , - 1 ) ;
581
577
} ,
582
578
583
579
/**
584
- * Replace the current route's parent .
580
+ * Replace the route/view for the previous page .
585
581
*/
586
582
replacePrevious : function ( route : Route ) {
587
583
this . replaceAtIndex ( route , - 2 ) ;
588
584
} ,
589
585
586
+ /**
587
+ * Go back to the top item
588
+ */
590
589
popToTop : function ( ) {
591
590
this . popToRoute ( this . state . routeStack [ 0 ] ) ;
592
591
} ,
593
592
593
+ /**
594
+ * Go back to the item for a particular route object
595
+ */
594
596
popToRoute : function ( route : Route ) {
595
597
var indexOfRoute = this . state . routeStack . indexOf ( route ) ;
596
598
invariant (
@@ -601,6 +603,9 @@ var NavigatorIOS = React.createClass({
601
603
this . popN ( numToPop ) ;
602
604
} ,
603
605
606
+ /**
607
+ * Replaces the previous route/view and transitions back to it.
608
+ */
604
609
replacePreviousAndPop : function ( route : Route ) {
605
610
// Make sure all previous requests are caught up first. Otherwise reject.
606
611
if ( this . state . requestedTopOfStack !== this . state . observedTopOfStack ) {
@@ -618,6 +623,9 @@ var NavigatorIOS = React.createClass({
618
623
} ) ;
619
624
} ,
620
625
626
+ /**
627
+ * Replaces the top item and popToTop
628
+ */
621
629
resetTo : function ( route : Route ) {
622
630
invariant ( ! ! route , 'Must supply route to push' ) ;
623
631
// Make sure all previous requests are caught up first. Otherwise reject.
@@ -628,7 +636,7 @@ var NavigatorIOS = React.createClass({
628
636
this . popToRoute ( route ) ;
629
637
} ,
630
638
631
- handleNavigationComplete : function ( e : Event ) {
639
+ _handleNavigationComplete : function ( e : Event ) {
632
640
if ( this . _toFocusOnNavigationComplete ) {
633
641
this . _getFocusEmitter ( ) . emit ( 'focus' , this . _toFocusOnNavigationComplete ) ;
634
642
this . _toFocusOnNavigationComplete = null ;
@@ -663,7 +671,7 @@ var NavigatorIOS = React.createClass({
663
671
) ;
664
672
} ,
665
673
666
- renderNavigationStackItems : function ( ) {
674
+ _renderNavigationStackItems : function ( ) {
667
675
var shouldRecurseToNavigator =
668
676
this . state . makingNavigatorRequest ||
669
677
this . state . updatingAllIndicesAtOrBeyond !== null ;
@@ -678,7 +686,7 @@ var NavigatorIOS = React.createClass({
678
686
style = { styles . transitioner }
679
687
vertical = { this . props . vertical }
680
688
requestedTopOfStack = { this . state . requestedTopOfStack }
681
- onNavigationComplete = { this . handleNavigationComplete } >
689
+ onNavigationComplete = { this . _handleNavigationComplete } >
682
690
{ items }
683
691
</ NavigatorTransitionerIOS >
684
692
</ StaticContainer >
@@ -688,7 +696,7 @@ var NavigatorIOS = React.createClass({
688
696
render : function ( ) {
689
697
return (
690
698
< View style = { this . props . style } >
691
- { this . renderNavigationStackItems ( ) }
699
+ { this . _renderNavigationStackItems ( ) }
692
700
</ View >
693
701
) ;
694
702
} ,
0 commit comments