react-navigation-underscore

0.0.3 • Public • Published

react-navigation-underscore

Generated with nod NPM version Build Status Coverage Status

A HOC to map all of your _ methods so they aren't so ugly to use with React Navigation.

Install

$ npm install --save react-navigation-underscore

Usage

Will take any _ method that is on the component and make it available within the navigation parameters.

This will not include any methods that start with '_react'

import withUnderscore from "react-navigation-underscore";
 
class WrapMe extends React.Component {
  _setSomething = () => this.setState({ something: true });
  
  static navigationOptions = ({ navigation }) => ({
    headerRight: (
      <Button 
        onPress={(navigation.state.params || {})._setSomething}
      />
    ),
  });
}
 
export default withUnderscore(WrapMe)

Parameters

  • component Component React Navigation aware component

Returns Component

License

MIT © James Armstead

/react-navigation-underscore/

    Package Sidebar

    Install

    npm i react-navigation-underscore

    Weekly Downloads

    3

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    6.11 kB

    Total Files

    5

    Last publish

    Collaborators

    • armsteadj1