npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sagredoismael/redux_rn

v1.0.16

Published

Basic redux implementation with persist data for react native projects

Downloads

32

Readme

ReactNative: Agile implementation of redux with data persistence and expiration of this persistence (Android/iOS)

📖 Getting started

$ yarn add @sagredoismael/redux_rn

or

$ npm i @sagredoismael/redux_rn

Prerequisite if you want to use Persist data

  • iOS

iOS Prerequisite: Please make sure CocoaPods is installed on your system

  1. Enter into iOS Folder cd ios/ (on your project's root folder).

  2. Add this line to your Podfile just below the last pod (if you don't have one, you can create it by running pod init):

+ pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
  1. Run pod install

  • Android
  1. Add project to android/settings.gradle:
rootProject.name = 'MyApp'

include ':app'

+ include ':@react-native-community_async-storage'
+ project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
  1. In android/app/build.gradle add to dependencies:
dependencies {
  ...
+ implementation project(':@react-native-community_async-storage')
}
  1. Then, in MainApplication.java:
package com.myapp;

+ import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;

...

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
+       ReactPackage asyncstorage = new AsyncStoragePackage();
 +         packages.add(asyncstorage);
    );
}

💻 Basic usage

import { ReduxWrapper } from '@sagredoismael/redux_rn'

const App = () => (
  <ReduxWrapper App={YouFirstComponentInApp}
  />
)

💻 With reducers usage

import { ReduxWrapper } from '@sagredoismael/redux_rn'

const exampleReducer = (state = {}, action) => {
  switch (action.type) {
      default:
          return state
  }
}

const App = () => (
  <ReduxWrapper 
   App={YouFirstComponentInApp}
   reducers= {{exampleReducer}}
  />
)

💻 Complete Usage (with persist)

import { ReduxWrapper } from '@sagredoismael/redux_rn'

const examplePersist = {
  whitelist: [
    'lastSession'
  ],
  blacklist: [],
  expired: [
    {
      name: 'lastSession',
      expireSeconds: 54000,
      expiredState: {} //initialState,
      autoExpire: true
    }
  ]
}

const exampleReducer = (state = {}, action) => {
  switch (action.type) {
      default:
          return state
  }
}

const App = () => (
  <ReduxWrapper 
   App={YouFirstComponentInApp}
   reducers= {{exampleReducer}}
   settingsPersist={examplePersist}
  />
)

💡 Props

  • General(iOS & Android)

| Prop | Type | Mandatory | Note | | ---------------------- | ------------------- | ------- | ------------------------------------------------ | | App | react component | YES | Specify a react component for initialize your App | | reducers | object | NO | Specify all reducers you want into combineReducers | settingsPersist | object | NO | Specify all persist config (whiteList, blackList && expired. **If you don't want time expired, is not necessary this props) |

✨ Credits

https://github.com/facebook/react https://github.com/reduxjs/react-redux https://github.com/reduxjs/redux https://github.com/rt2zz/redux-persist https://github.com/reduxjs/redux-thunk https://github.com/LogRocket/redux-logger https://github.com/kamranahmedse/redux-persist-expire https://github.com/react-native-community/async-storage https://github.com/react-native-community/async-storage/blob/LEGACY/docs/Linking.md

🤔 How to contribute

Have an idea? Found a bug? Please you can write me and I get you permission to the repo!

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list below. ✨

📜 License

MIT license