shaara-preset-react-native
v0.4.0
Published
Preset for react-native development
Downloads
1
Maintainers
Readme
shaara-preset-react-native
Preset to develop with react-native. It includes great utility tools to work in a mobile environment, yet it's purely Javascript.
Services
- store : manage a redux store with persistence.
- network.status : manage the network status
- request.sender : allows to send HTTP request. It uses the bridge pattern to allow different fetch implementation given test or development|production environment. On test environment, it will use Faussaire to mock HTTP requests, and a service called faussaire will be added to add custom routes and handlers. See Faussaire documentation on github.
- security.token : allows an authentification mechanism. It will rely on a getTokenImplementation method in the configuration to customize how to set and get a token (usually from the store)
Parameters
- fetch : if provided, the request sender will use this function instead of the global fetch. Indeed this preset rely on the fetch method. If you want to use Axios or Frisbee or example, you can easily write an adapter that follows the same API as fetch. One day we will provide a function "requestImplementation" to allow changing it easily.
Configuration
getStoreConfiguration () => { reducers : {[key: string]: ReducerType, debounce : number }
Configure the store with reducers. Debounce is used for persistence. It ensures the store doesn't get persisted more often than this amount of time. Default is 500.
getTokenImplementation () => { setToken: (token : T) => void, getToken: () => T }
Configure the SecurityToken system.