npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-navigator-router

v0.2.1

Published

Integration React Native and React Router with navigator.

Downloads

13

Readme

React Native Navigator Router

Integration React Native Navigator with React Router.

Introduction

React Native is a powerful tool to build iOS and Android Apps by writing JavaScript code only once. As React works on web pages, React Native also has the same problem to navigating from different pages. React Router is a good solution to manage page and navigate by URL addresses. React Native has a component named Navigator to manage pages. But it only provided original interfaces so managing pages is a headache problem in developing apps. If we only use React Router without Navigator, we should invent some "wheels" to solve animations, page stacks problems. So integration React Native Navigator with React Router is a reasonable way to go.

Installation

npm install react-native-navigator-router --save

Usage

import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { createMemoryHistory, Router, IndexRoute, Route } from 'react-router';
import { createNavigatorRouter } from 'react-native-navigator-router';

class App extends Component {
  render() {
    return (
      <Router history={createMemoryHistory('/')}>
        <Route path='/' component={createNavigatorRouter()}>
          <IndexRoute component={Home} />
          <Route path="/about" component={About} />
          <Route path="/detail" component={Detail} />
        </Route>
      </Router>
    );
  }
}

AppRegistry.registerComponent('Example', () => App);

For complete code, see Example.

Example

To run example project, you should run command as following lines:

cd Example
npm install
react-native run-ios

API

This component only has one function. It's quite simple.

createNavigatorRouter

createNavigatorRouter(onBack: (index) => boolean[, style: StyleSheet])

Use this function to create React Router root component, pass onBack argument to it if you are planing to handle back by your self. style argument will apply to Navigator component's style prop. Use it if you want to define your Navigator styles.

Once you configured it, you can use URL to define your pages and navgating between them by simply push or back url. Enjoy it!

Limition

  • Only push, goBack and go with negative index are fully support, jump havn't been tested yet, any other operations are not support.
  • Need more testing and feedback.
  • Not support persist/restore the page stack.

Use with Redux

This component is compatible with Redux, you can use React Router Redux to integration them. No special configurations is needed, just following the documents.

Showcase

The following Apps are using:

Feedback

If you any questions, use Issues.

Sina Weibo: @starlight36

License

MIT Licence.