You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-navigation-mobx-helpers

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-navigation-mobx-helpers

React-Navigation bindings for MobX

2.0.1
latest
Source
npmnpm
Version published
Weekly downloads
8
166.67%
Maintainers
1
Weekly downloads
 
Created
Source

react-navigation-mobx-helpers

React-Navigation bindings for MobX

Installation

npm install react-navigation-mobx-helpers --save

Usage

import React from 'react';
import { Provider, inject, observer } from 'mobx-react';
import { StackNavigator } from 'react-navigation';
import NavigationStore from 'react-navigation-mobx-helpers';

const RootNavigator = StackNavigator(RouteConfigs);

const rootNavigation = new NavigationStore();

class Root extends React.Component {
  render() {
    return (
      <Provider rootNavigation={rootNavigation}>
        <App />
      </Provider>
    );
  }
}

@inject('rootNavigation')
@observer
class App extends React.Component {
  render() {
    const { rootNavigation } = this.props;
    return <RootNavigator ref={rootNavigation.createRef} />;
  }
}

API

ActionParameterDescription
createRefref: React.ComponentSave an instance of navigation to store
dispatchaction: NavigationActionSend an action to router
getParamparamName: string, fallback?: NavigationParamsGet a specific param with fallback
setParamsnewParams: NavigationParamsMake changes to route's params
navigate{ routeName: string, params?: NavigationParams, action?: NavigationAction, key?: string } OR routeName: string, params?: NavigationParams, action?: NavigationActionGo to another screen, figures out the action it needs to take to do it
pushrouteName: string, params?: NavigationParams, action?: NavigationActionNavigate forward to new route in stack
replacerouteName: string, params?: NavigationParams, action?: NavigationActionReplace the current route with a new one
goBackrouteKey?: string | nullClose active screen and move back in the stack
popn?: number, params?: { immediate?: boolean }Go back in the stack
popToTopparams?: { immediate?: boolean }Go to the top of the stack

Keywords

react-native

FAQs

Package last updated on 13 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts