0.0.28 • Published 7 years ago

react-native-scene-router v0.0.28

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

Scene Router

This package wraps the existing Navigator api from react-native to enable:

  • An arbitrary graph of scenes in json
  • An api for traversing that graph
  • Consistent navigation bar between scenes
  • A menu drawer

These docs provide a high level usage overview. See this sample app for an example usage and see the code (it's not that long).

What is a scene?

A scene is an individual view on the screen of the phone. An app with Scene Router is composed of a graph with scenes as nodes and possible transitions as edges.

RoutableScene

A react component which is a complete scene and aware of the graph. It can trigger transitions between scenes.

Scenes are represented as a stack and transitions either push or pop from the stack.

Types of transition methods available to children:

  • goNext(route = next) - Push a scene to the stack. By default pushes routeLinks['next'] on to the stack but can be used to have multiple next scenes by calling goNext('fancyRoute') which will push routeLinks['fancyRoute'].
  • goBack() - Pop one scene from the stack.
  • goMenu() - Opens the menu drawer if a menu was supplied to the wrapping DrawerNavigator
  • goReturn() - Can return to arbitrary route earlier in the stack or go back any number of scenes.
  • goHome() - Pop to the bottom element of the stack.

DrawerNavigator

Your app's main component should be a drawer navigator which manages rendering the current route.

Props:

  • routeLinks - Links between scenes defining possible transitions.
  • initialRoute - The scene which should be rendered first.
  • renderMenu - Render method which returns menu react component.
0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago