diff --git a/docs/next/navigation.html b/docs/next/navigation.html index 377c91ce6b7..d41871033e3 100644 --- a/docs/next/navigation.html +++ b/docs/next/navigation.html @@ -35,7 +35,6 @@ });
Edit

Navigating Between Screens

Mobile apps are rarely made up of a single screen. Managing the presentation of, and transition between, multiple screens is typically handled by what is known as a navigator.

This guide covers the various navigation components available in React Native. If you are just getting started with navigation, you will probably want to use React Navigation. React Navigation provides an easy to use navigation solution, with the ability to present common stack navigation and tabbed navigation patterns on both iOS and Android.

-

If you're only targeting iOS, you may want to also check out NavigatorIOS as a way of providing a native look and feel with minimal configuration, as it provides a wrapper around the native UINavigationController class. This component will not work on Android, however.

If you'd like to achieve a native look and feel on both iOS and Android, or you're integrating React Native into an app that already manages navigation natively, the following library provides native navigation on both platforms: react-native-navigation.

React Navigation

The community solution to navigation is a standalone library that allows developers to set up the screens of an app with just a few lines of code.

@@ -73,74 +72,6 @@

React Navigation routers make it easy to override navigation logic. Because routers can be nested inside each other, developers can override navigation logic for one area of the app without making widespread changes.

The views in React Navigation use native components and the Animated library to deliver 60fps animations that are run on the native thread. Plus, the animations and gestures can be easily customized.

For a complete intro to React Navigation, follow the React Navigation Getting Started Guide, or browse other docs such as the Intro to Navigators.

-

NavigatorIOS

-

NavigatorIOS looks and feels just like UINavigationController, because it is actually built on top of it.

-

-
<NavigatorIOS
-  initialRoute={{
-    component: MyScene,
-    title: 'My Initial Scene',
-    passProps: {myProp: 'foo'},
-  }}
-/>
-
-

Like other navigation systems, NavigatorIOS uses routes to represent screens, with some important differences. The actual component that will be rendered can be specified using the component key in the route, and any props that should be passed to this component can be specified in passProps. A "navigator" object is automatically passed as a prop to the component, allowing you to call push and pop as needed.

-

As NavigatorIOS leverages native UIKit navigation, it will automatically render a navigation bar with a back button and title.

-
import React from 'react';
-import PropTypes from 'prop-types';
-import {Button, NavigatorIOS, Text, View} from 'react-native';
-
-export default class NavigatorIOSApp extends React.Component {
-  render() {
-    return (
-      <NavigatorIOS
-        initialRoute={{
-          component: MyScene,
-          title: 'My Initial Scene',
-          passProps: {index: 1},
-        }}
-        style={{flex: 1}}
-      />
-    );
-  }
-}
-
-class MyScene extends React.Component {
-  static propTypes = {
-    route: PropTypes.shape({
-      title: PropTypes.string.isRequired,
-    }),
-    navigator: PropTypes.object.isRequired,
-  };
-
-  constructor(props, context) {
-    super(props, context);
-    this._onForward = this._onForward.bind(this);
-  }
-
-  _onForward() {
-    let nextIndex = ++this.props.index;
-    this.props.navigator.push({
-      component: MyScene,
-      title: 'Scene ' + nextIndex,
-      passProps: {index: nextIndex},
-    });
-  }
-
-  render() {
-    return (
-      <View>
-        <Text>Current Scene: {this.props.title}</Text>
-        <Button
-          onPress={this._onForward}
-          title="Tap me to load the next scene"
-        />
-      </View>
-    );
-  }
-}
-
-

Check out the NavigatorIOS reference docs to learn more about this component.

Edit

Navigating Between Screens

Mobile apps are rarely made up of a single screen. Managing the presentation of, and transition between, multiple screens is typically handled by what is known as a navigator.

This guide covers the various navigation components available in React Native. If you are just getting started with navigation, you will probably want to use React Navigation. React Navigation provides an easy to use navigation solution, with the ability to present common stack navigation and tabbed navigation patterns on both iOS and Android.

-

If you're only targeting iOS, you may want to also check out NavigatorIOS as a way of providing a native look and feel with minimal configuration, as it provides a wrapper around the native UINavigationController class. This component will not work on Android, however.

If you'd like to achieve a native look and feel on both iOS and Android, or you're integrating React Native into an app that already manages navigation natively, the following library provides native navigation on both platforms: react-native-navigation.

React Navigation

The community solution to navigation is a standalone library that allows developers to set up the screens of an app with just a few lines of code.

@@ -73,74 +72,6 @@

React Navigation routers make it easy to override navigation logic. Because routers can be nested inside each other, developers can override navigation logic for one area of the app without making widespread changes.

The views in React Navigation use native components and the Animated library to deliver 60fps animations that are run on the native thread. Plus, the animations and gestures can be easily customized.

For a complete intro to React Navigation, follow the React Navigation Getting Started Guide, or browse other docs such as the Intro to Navigators.

-

NavigatorIOS

-

NavigatorIOS looks and feels just like UINavigationController, because it is actually built on top of it.

-

-
<NavigatorIOS
-  initialRoute={{
-    component: MyScene,
-    title: 'My Initial Scene',
-    passProps: {myProp: 'foo'},
-  }}
-/>
-
-

Like other navigation systems, NavigatorIOS uses routes to represent screens, with some important differences. The actual component that will be rendered can be specified using the component key in the route, and any props that should be passed to this component can be specified in passProps. A "navigator" object is automatically passed as a prop to the component, allowing you to call push and pop as needed.

-

As NavigatorIOS leverages native UIKit navigation, it will automatically render a navigation bar with a back button and title.

-
import React from 'react';
-import PropTypes from 'prop-types';
-import {Button, NavigatorIOS, Text, View} from 'react-native';
-
-export default class NavigatorIOSApp extends React.Component {
-  render() {
-    return (
-      <NavigatorIOS
-        initialRoute={{
-          component: MyScene,
-          title: 'My Initial Scene',
-          passProps: {index: 1},
-        }}
-        style={{flex: 1}}
-      />
-    );
-  }
-}
-
-class MyScene extends React.Component {
-  static propTypes = {
-    route: PropTypes.shape({
-      title: PropTypes.string.isRequired,
-    }),
-    navigator: PropTypes.object.isRequired,
-  };
-
-  constructor(props, context) {
-    super(props, context);
-    this._onForward = this._onForward.bind(this);
-  }
-
-  _onForward() {
-    let nextIndex = ++this.props.index;
-    this.props.navigator.push({
-      component: MyScene,
-      title: 'Scene ' + nextIndex,
-      passProps: {index: nextIndex},
-    });
-  }
-
-  render() {
-    return (
-      <View>
-        <Text>Current Scene: {this.props.title}</Text>
-        <Button
-          onPress={this._onForward}
-          title="Tap me to load the next scene"
-        />
-      </View>
-    );
-  }
-}
-
-

Check out the NavigatorIOS reference docs to learn more about this component.

Edit

NavigatorIOS

NavigatorIOS is a wrapper around UINavigationController, enabling you to implement a navigation stack. It works exactly the same as it would on a native app using UINavigationController, providing the same animations and behavior from UIKit.

+
Edit

NavigatorIOS

DEPRECATED - use one of the available third party library for navigations, such as React Navigation or react-native-navigation.

+

NavigatorIOS is a wrapper around UINavigationController, enabling you to implement a navigation stack. It works exactly the same as it would on a native app using UINavigationController, providing the same animations and behavior from UIKit.

As the name implies, it is only available on iOS. Take a look at React Navigation for a cross-platform solution in JavaScript, or check out either of these components for native solutions: native-navigation, react-native-navigation.

To set up the navigator, provide the initialRoute prop with a route object. A route object is used to describe each scene that your app navigates to. initialRoute represents the first route in your navigator.

import PropTypes from 'prop-types';
diff --git a/docs/next/navigatorios/index.html b/docs/next/navigatorios/index.html
index 14890ef91e3..6e65e370fba 100644
--- a/docs/next/navigatorios/index.html
+++ b/docs/next/navigatorios/index.html
@@ -1,4 +1,4 @@
-NavigatorIOS · React Native
Edit

NavigatorIOS

NavigatorIOS is a wrapper around UINavigationController, enabling you to implement a navigation stack. It works exactly the same as it would on a native app using UINavigationController, providing the same animations and behavior from UIKit.

+
Edit

NavigatorIOS

DEPRECATED - use one of the available third party library for navigations, such as React Navigation or react-native-navigation.

+

NavigatorIOS is a wrapper around UINavigationController, enabling you to implement a navigation stack. It works exactly the same as it would on a native app using UINavigationController, providing the same animations and behavior from UIKit.

As the name implies, it is only available on iOS. Take a look at React Navigation for a cross-platform solution in JavaScript, or check out either of these components for native solutions: native-navigation, react-native-navigation.

To set up the navigator, provide the initialRoute prop with a route object. A route object is used to describe each scene that your app navigates to. initialRoute represents the first route in your navigator.

import PropTypes from 'prop-types';