Giter Club home page Giter Club logo

react-navigation's Introduction

Example app from https://reactnavigation.org/docs/en/getting-started.html

Installation

  1. Create react-native app with expo:
expo init react-navigation --template blank@sdk-32 --yarn
  1. Installing libraries
cd react-navigation
yarn add react-navigation --save
yarn add native-base --save
yarn add @expo/vector-icons --save

Step 1

Create a HomeScreen and use a stack navigator to route to it.

See this diff for the solution.

Step 2

Create a DetailsScreen and navigate to it from the HomeScreen.

see this diff for the solution.

Step 3

Pass data to DetailsScreen via navigation parameters.

see this diff for the solution.

Step 4

Set and update screen titles.

see this diff for the solution.

Step 5

Add header buttons. We will add a header button to the HomeScreen and link it to the SettingsScreen. Please make sure you have run the following in your project directory:

yarn add @expo/vector-icons --save

see this diff for the solution.

Note that this example demonstrates a pattern for giving a header button access to a function on the component instance using params. If you simply want to route to another screen the following will suffice:

<Button dark transparent
  onPress={navigation.navigate('Settings')}>
  <Icon name='cog' />
</Button>

Step 6

Create a full-screen modal using nested navigators.

Note that we have to provide the header, as needed, for the modal screen because the HeaderMode is set none so that we don't show the back button from the navigator. The modal can be dismissed by swiping its header downward.

see this diff for the solution.

Step 7

Add a bottom tab navigator.

react-navigation's People

Contributors

lubaochuan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.