Edit page

Getting Started

Installation

React-nonav needs the following dependencies; if you do not have those installed, you need to install them with the correspondig command:

Dependencie nameYarn Installation commandNPM Installation command
rxjsyarn add rxjsnpm i rxjs
react-native-reanimatedyarn add react-native-reanimatednpm i react-native-reanimated

Then, follow any post-installation instruction of react-native-reanimated. See react-native-reanimated Installation Instructions.

Then, install React-Nonav with:

yarn add react-nonav

or

npm i react-nonav

Basic Usage

Create a canal

In order to create a canal, use the Canal and Screen components. Your screens order is important: the order is the elevation order. If two or more screens are visible, last visible in the array is shown.

That's all !

Add a full screen page

If you want to add full screen page, pass the isFullScreen flag prop to your Screen when creating a canal. In the following example, lastname is a full screen page.

In order to render the full screen page, add the FullScreenPortal at the top level in your rendering tree.

Go Back

Back events are also managed in a declarative way. Use the onBack callback prop on your screen.

⚠️ Warning
You should use a state machine in order to make your canal a controlled component. In fact, your `onBack` callbacks should modify your state in a way it affects the visibility of your screens. See the example in the repo.
ℹ Info
If you have nested or multiple canals, here is the priority of `onBack` callbacks:
- Last visible full-screen screen.
- Deepest visible screen.

You are ready to use React-Nonav 🎸.