From b28695ac6e8bc9007aa204fd2d30e72e1f58a98e Mon Sep 17 00:00:00 2001 From: Spencer Carli Date: Fri, 15 Sep 2017 16:02:11 -0500 Subject: [PATCH] Merge branch 'probeadd-master' --- .../docs/guides/Guide-Intro.md | 20 +++++++++++++++++-- .../docs/guides/Guide-Nested.md | 12 ++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/react-navigation/docs/guides/Guide-Intro.md b/packages/react-navigation/docs/guides/Guide-Intro.md index 41ffb36c..6cfdd824 100644 --- a/packages/react-navigation/docs/guides/Guide-Intro.md +++ b/packages/react-navigation/docs/guides/Guide-Intro.md @@ -20,6 +20,21 @@ react-native run-android # or: react-native run-ios ``` +If you are using `create-react-native-app` instead of `react-native init`, then: +```sh +# Create a new React Native App +create-react-native-app SimpleApp +cd SimpleApp + +# Install the latest version of react-navigation from npm +npm install --save react-navigation + +# Run the new app +npm start + +# This will start a development server for you and print a QR code in your terminal. +``` + Verify that you can successfully see the bare sample app run on iOS and/or Android: ```phone-example @@ -51,10 +66,11 @@ class HomeScreen extends React.Component { } } -const SimpleApp = StackNavigator({ +export default const SimpleApp = StackNavigator({ Home: { screen: HomeScreen }, }); +// if you are using create-react-native-app you don't need this line AppRegistry.registerComponent('SimpleApp', () => SimpleApp); ``` @@ -110,7 +126,7 @@ class HomeScreen extends React.Component { We're using the navigate function from the [screen navigation prop](/docs/navigators/navigation-prop) to go to `ChatScreen`. But that won't work until we add this to our `StackNavigator` like so: ```js -const SimpleApp = StackNavigator({ +export default const SimpleApp = StackNavigator({ Home: { screen: HomeScreen }, Chat: { screen: ChatScreen }, }); diff --git a/packages/react-navigation/docs/guides/Guide-Nested.md b/packages/react-navigation/docs/guides/Guide-Nested.md index 118b16c9..818b6a45 100644 --- a/packages/react-navigation/docs/guides/Guide-Nested.md +++ b/packages/react-navigation/docs/guides/Guide-Nested.md @@ -53,9 +53,15 @@ const SimpleApp = StackNavigator({ Because `MainScreenNavigator` is being used as a screen, we can give it `navigationOptions`: ```js -MainScreenNavigator.navigationOptions = { - title: 'My Chats', -}; +const SimpleApp = StackNavigator({ + Home: { + screen: MainScreenNavigator, + navigationOptions: { + title: 'My Chats', + }, + }, + Chat: { screen: ChatScreen }, +}) ``` Lets also add a button to each tab that links to a chat: