Glue AppState from react-native to Redux
JavaScript Makefile
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.babelrc
.editorconfig
.eslintrc
.gitignore
.npmignore
.travis.yml
LICENSE.txt
Makefile
README.md
package.json

README.md

redux-middleware-react-native-appstate

license npm version npm downloads Code Climate build

Glue AppState from react-native to Redux.

Deprecated - No longer maintained

My focus has left the node / react ecosystem and this module is no longer maintained.

Thank you for your patience and using this module in the first place!

Installation

npm install --save redux-middleware-react-native-appstate

Usage

// Just import the middleware and add it to your store
import { createStore, applyMiddleware } from 'redux';
import { middleware as appState } from 'redux-middleware-react-native-appstate';
const createStoreWithMiddleware = applyMiddleware(appState)(createStore);

// And in your reducers receive the value
import { TYPE as APP_STATE } from 'redux-middleware-react-native-appstate';

function appStateReducer(state = {}, action) {
    switch (action.type) {
        case APP_STATE:
            console.log('AppState:', action.payload);

        default:
            return state;
    }
}

Todo

  • Write tests for everything!