diff --git a/Examples/UIExplorer/NavigatorIOSExample.js b/Examples/UIExplorer/NavigatorIOSExample.js
index 08d227c3f..3c6f19f94 100644
--- a/Examples/UIExplorer/NavigatorIOSExample.js
+++ b/Examples/UIExplorer/NavigatorIOSExample.js
@@ -15,11 +15,12 @@
*/
'use strict';
-var React = require('react-native');
-var ViewExample = require('./ViewExample');
-var createExamplePage = require('./createExamplePage');
-var {
+const React = require('react-native');
+const ViewExample = require('./ViewExample');
+const createExamplePage = require('./createExamplePage');
+const {
AlertIOS,
+ NavigatorIOS,
ScrollView,
StyleSheet,
Text,
@@ -27,8 +28,7 @@ var {
View,
} = React;
-var EmptyPage = React.createClass({
-
+const EmptyPage = React.createClass({
render: function() {
return (
@@ -38,41 +38,24 @@ var EmptyPage = React.createClass({
);
},
-
});
-var NavigatorIOSExample = React.createClass({
-
- statics: {
- title: '',
- description: 'iOS navigation capabilities',
- },
-
+const NavigatorIOSExamplePage = React.createClass({
render: function() {
var recurseTitle = 'Recurse Navigation';
- if (!this.props.topExampleRoute) {
+ if (!this.props.depth || this.props.depth === 1) {
recurseTitle += ' - more examples here';
}
return (
-
-
-
-
- See <UIExplorerApp> for top-level usage.
-
-
-
-
-
{this._renderRow(recurseTitle, () => {
this.props.navigator.push({
title: NavigatorIOSExample.title,
- component: NavigatorIOSExample,
+ component: NavigatorIOSExamplePage,
backButtonTitle: 'Custom Back',
- passProps: {topExampleRoute: this.props.topExampleRoute || this.props.route},
+ passProps: {depth: this.props.depth ? this.props.depth + 1 : 1},
});
})}
{this._renderRow('Push View Example', () => {
@@ -122,40 +105,39 @@ var NavigatorIOSExample = React.createClass({
{this._renderRow('Pop to top', () => {
this.props.navigator.popToTop();
})}
- {this._renderRow('Replace here', () => {
- var prevRoute = this.props.route;
- this.props.navigator.replace({
- title: 'New Navigation',
- component: EmptyPage,
- rightButtonTitle: 'Undo',
- onRightButtonPress: () => this.props.navigator.replace(prevRoute),
- passProps: {
- text: 'The component is replaced, but there is currently no ' +
- 'way to change the right button or title of the current route',
- }
- });
- })}
+ {this._renderReplace()}
{this._renderReplacePrevious()}
{this._renderReplacePreviousAndPop()}
- {this._renderPopToTopNavExample()}
+ {this._renderRow('Exit NavigatorIOS Example', this.props.onExampleExit)}
);
},
- _renderPopToTopNavExample: function() {
- if (!this.props.topExampleRoute) {
+ _renderReplace: function() {
+ if (!this.props.depth) {
+ // this is to avoid replacing the top of the stack
return null;
}
- return this._renderRow('Pop to top NavigatorIOSExample', () => {
- this.props.navigator.popToRoute(this.props.topExampleRoute);
+ return this._renderRow('Replace here', () => {
+ var prevRoute = this.props.route;
+ this.props.navigator.replace({
+ title: 'New Navigation',
+ component: EmptyPage,
+ rightButtonTitle: 'Undo',
+ onRightButtonPress: () => this.props.navigator.replace(prevRoute),
+ passProps: {
+ text: 'The component is replaced, but there is currently no ' +
+ 'way to change the right button or title of the current route',
+ }
+ });
});
},
_renderReplacePrevious: function() {
- if (!this.props.topExampleRoute) {
- // this is to avoid replacing the UIExplorerList at the top of the stack
+ if (!this.props.depth || this.props.depth < 2) {
+ // this is to avoid replacing the top of the stack
return null;
}
return this._renderRow('Replace previous', () => {
@@ -171,8 +153,8 @@ var NavigatorIOSExample = React.createClass({
},
_renderReplacePreviousAndPop: function() {
- if (!this.props.topExampleRoute) {
- // this is to avoid replacing the UIExplorerList at the top of the stack
+ if (!this.props.depth || this.props.depth < 2) {
+ // this is to avoid replacing the top of the stack
return null;
}
return this._renderRow('Replace previous and pop', () => {
@@ -203,7 +185,34 @@ var NavigatorIOSExample = React.createClass({
},
});
-var styles = StyleSheet.create({
+const NavigatorIOSExample = React.createClass({
+ statics: {
+ title: '',
+ description: 'iOS navigation capabilities',
+ external: true,
+ },
+
+ render: function() {
+ const {onExampleExit} = this.props;
+ return (
+
+ );
+ },
+});
+
+const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ },
customWrapperStyle: {
backgroundColor: '#bbdddd',
},