yogeshwar nair
yogeshwar nair

Reputation: 813

Detect and handle slow internet connection in React-Native

Currently I am using NetInfo of react-native and with the help of EffectiveConnectionType, I am able to find the connection is in : 2g, 3g, 4g and unknown. But is there any optimise way to handle this problem ?

Upvotes: 7

Views: 21427

Answers (2)

yogeshwar nair
yogeshwar nair

Reputation: 813

You can use https://github.com/rgommezz/react-native-offline or you can simply add timeout in axios...if request is aborted after particular time say 10 sec...re-hit the same API request and set the count limit if count limit exceeds...You can show the slow internet message.

Upvotes: 7

Julien Malige
Julien Malige

Reputation: 3475

I use the react-native-offline lib.

Among other things, withNetworkConnectivity() that frequently ping an url, offline queues to never miss an action...

https://github.com/rgommezz/react-native-offline

Upvotes: 2

Related Questions