NetInfo in react-native is returning isConnected as false even when network is connected -
we using react-native netinfo in following way.
export default class networkstatus extends react.purecomponent { constructor(props){ super(props); netinfo.addeventlistener( 'change', this.onconnectivitychange ); } onconnectivitychange = (status) => { netinfo.isconnected.fetch().then(isconnected => { console.log('*********network status ' + (isconnected ? 'online' : 'offline')); }); }
launched app in offline mode. got following console.
*********network status offline.
then turned on wifi , connected. got offline console twice.
*********network status offline.
*********network status offline.
is bug in netinfo library. there way fix it.
versions used :
"react": "16.0.0-alpha.6"
"react-native": "0.44.0",
Comments
Post a Comment