Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Testing and logging "Device Offline" in react-native development environment

$
0
0

I'm building offline capabilities for my app and having trouble figuring out how to test them properly.

I'm using the net-info library wrapped in a context to provide the app with information about the devices connection status:

const Connection = ({ children })=>{    const netInfo = useNetInfo();    const {        isConnected,        type,    } = netInfo;    useEffect(()=>{        console..log(`CONNECTION ${isConnected} ${type}`);      },[ isConnected, type]);    return (<ConnectionContext.Provider            value={{                online: netInfo.isConnected,                type: netInfo.type,            }}>            { children }</ConnectionContext.Provider>    )}

If I manually disconnect the wifi and data, the app loses its connection to the development server and stops giving me information/logs and I can't really follow what is happening.

How do I get around this?


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>