@collinbrewer/react-navigation-view
v0.3.0
Published
React Navigation View
Readme
React Navigation View
An iOS-inspired navigation view for React.
The API is modeled largely after react-navigation-controller minus some fusses I had with its implementation:
- The use of
cloneElementwhich causes numerous reference issues - Complaints from React(and subsequent issues) due to components being created outside of the navigation controller's
rendermethod
To overcome these issues, this component uses two approaches:
- Uncontrolled (like
react-navigation-controller)- The
defaultViewsprop will be used to render the initial state of the navigation stack - The
pushViewmethod will not accept React components, but instead a function that returns a React component, so the creation can more appropriately be deferred until theReactNavigationViews render method is called by React
- The
- Controlled
- The children passed to
ReactNavigationViewwill be used as the views for the navigation stack - None of the mutation methods(
pushView,popView,popToRoot) will affect the navigation stack
- The children passed to
Demo & Examples
To build the examples locally, run:
npm install
npm startInstallation
npm install @collinbrewer/react-navigation-view -SUsage
var ReactNavigationView = require('@collinbrewer/react-navigation-view');
<ReactNavigationView ref='navigationView'>Example</ReactNavigationView>
this.refs.navigationView.pushView(() => {
return <div>Screen 2</div>
});License
ISC Licensed. Copyright (c) 2016 Collin Brewer.
