react-native-navigation-actions

1.0.4 • Public • Published

react-native-navigation-actions

This library offer nice abstractions and flexibility around react-navigation.

Installation

If you use yarn:

yarn add react-native-navigation-actions

If you use npm:

npm install --save react-native-navigation-actions

Construct a AppNavigator object passing you main Navigator (root).

import { StackNavigator } from 'react-navigation';
import { AppNavigator } from 'react-native-navigation-actions';
 
const Stack = StackNavigator({
  ItemList: { screen: require('...').default },
  Item: { screen: require('...').default },
})
 
const AppNav = AppNavigator(Stack)
 
/*...*/
 
import { AppRegistry } from 'react-native';
AppRegistry.registerComponent('RNTemplateProj', () => AppNav);

Usage

react-native-navigation-actions provides Actions that's dispatch NavigationActions in a simple call, and a navigatorRef just because it might be needed at some point.

import { Actions, navigatorRef } from 'react-nativenavigation-actions';
 
// At any point you can call:
Actions.navigate({ routeName: 'Item', params: { title: item.name }})
Actions.navigate('DrawerOpen')

API functions:

Same API as https://reactnavigation.org/docs/navigation-actions.html:

  • back
  • reset
  • setParams
  • init
  • reset
  • replace
  • push
  • poppopToTop

/react-native-navigation-actions/

    Package Sidebar

    Install

    npm i react-native-navigation-actions

    Weekly Downloads

    2

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    5.67 kB

    Total Files

    5

    Last publish

    Collaborators

    • pedro.goes