Socket
Socket
Sign inDemoInstall

react-navigation-mobx-helpers

Package Overview
Dependencies
548
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-navigation-mobx-helpers

React-Navigation bindings for MobX


Version published
Weekly downloads
20
increased by42.86%
Maintainers
1
Install size
5.62 MB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 13 Dec 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc