Handy toolbelt to deal nicely with offline/online connectivity in a React Native app. Smooth redux integration ✈️
Fixes a peer dependency issue with [email protected]
[email protected]
Added useIsConnected
hook
Adds a mechanism control for the offline queue, in order to decide when to release it.
For that, createNetworkMiddleware
now receives a new optional parameter, shouldDequeueSelector
. See more here
This release exposes a new api, createReducer
, that allows you to customise the way the offline queue handles duplicates.
checkInternetConnection
shouldPing
This release is a full-blown refactor of the library, where some of the core components have been re-written from scratch, providing a better modularity, using the latest React features and adopting a TDD strategy, where all the code is unit tested to facilitate external contributions in the future.
withNetworkConnectivity
HOC has been replaced with NetworkProvider
and NetworkConsumer
components, that leverage the new React Context API.timeout
-> pingTimeout
withExtraHeadRequest
-> shouldPing
checkConnectionInterval
-> pingInterval
checkIntervalOfflineOnly
-> pingOnlyIfOffline
checkInBackground
-> pingInBackground
ConnectivityRenderer
doesn't exist anymore. Use NetworkConsumer
from now on.withNetworkConnectivity({ withRedux: true })
has been replaced with ReduxNetworkProvider
component.ReduxNetworkProvider
receives the same props as NetworkProvider
to configure the behaviour.networkEventsListenerSaga
has been renamed to networkSaga
.checkInternetConnection
Function params order has been reversed. Now 1st argument is the url
and 2nd the timeout
.