Giter Site home page Giter Site logo

react-native-scene-router's Introduction

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.

react-native-scene-router's People

Contributors

matthewdailey avatar radicalmatt avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

manguluka

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.