You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-9
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
Handful of utilities you should keep in your toolbelt to handle offline/online connectivity in React Native. It supports both iOS and Android platforms. You can leverage all the functionalities provided or just the ones that suits your needs, the modules are conveniently decoupled.
6
6
7
-
Check out [this medium article](https://blog.callstack.io/your-react-native-offline-tool-belt-795abd5f0183) to see the power of the library with real world examples! 🚀
7
+
Check out [this medium article](https://blog.callstack.io/your-react-native-offline-tool-belt-795abd5f0183) to see the power of the library with real world examples! 🚀
8
8
9
9
## Contents
10
10
@@ -28,7 +28,7 @@ Check out [this medium article](https://blog.callstack.io/your-react-native-offl
28
28
## Motivation
29
29
When you are building your React Native app, you have to expect that some users may use your application in offline mode, for instance when travelling on a Plane (airplane mode) or the underground (no signal). How does your app behaves in that situation? Does it show an infinite loader? Can the user still use it seamlessly?
30
30
31
-
Having an offline first class citizen app is very important for a successful user experience. React Native ships with `NetInfo` module in order to detect internet connectivity. The API is pretty basic and it may be sufficient for small apps but its usage gets cumbersome as your app grows. Besides that, it only detects network connectivity and does not garantee internet access so it can provide false positives.
31
+
Having an offline first class citizen app is very important for a successful user experience. React Native ships with `NetInfo` module in order to detect internet connectivity. The API is pretty basic and it may be sufficient for small apps but its usage gets cumbersome as your app grows. Besides that, it only detects network connectivity and does not guarantee internet access so it can provide false positives.
32
32
33
33
This library aims to gather a variety of modules that follow React and redux best practises, in order to make your life easier when it comes to deal with internet connectivity in your React Native application.
34
34
@@ -40,6 +40,7 @@ This library aims to gather a variety of modules that follow React and redux bes
40
40
-**A step further than `NetInfo` detecting internet access besides network connectivity**
41
41
- Offline queue support to automatically re-dispatch actions when connection is back online or **dismiss actions based on other actions dispatched (i.e navigation related)**
42
42
- Typed with Flow
43
+
- Check connectivity regularly (optional)
43
44
44
45
## Installation
45
46
@@ -74,6 +75,7 @@ type Config = {
74
75
timeout?: number =3000,
75
76
pingServerUrl?: string ='https://google.com',
76
77
withExtraHeadRequest?: boolean =true,
78
+
checkConnectionInterval?: number =0,
77
79
}
78
80
```
79
81
@@ -86,6 +88,8 @@ type Config = {
86
88
87
89
`withExtraHeadRequest`: flag that denotes whether the extra ping check will be performed or not. Defaults to `true`.
88
90
91
+
`checkConnectionInterval`: the interval (in ms) you want to ping the server at. The default is 0, and that means it is not going to regularly check connectivity.
92
+
89
93
##### Usage
90
94
```js
91
95
importReactfrom'react';
@@ -198,7 +202,7 @@ let App = () => (
198
202
199
203
App =withNetworkConnectivity({
200
204
withRedux:true// It won't inject isConnected as a prop in this case
0 commit comments