react-native-cached-image
react-native-cached-image copied to clipboard
Netinfo error
Hi there i had an issue with the library.I think it can be related to the fact that netinfo library is not part of the standard react library anymore so the api has changed. The caching process fail with error: Netinfo.isConnected undefined.
I think networkAvailable flag is not used anywhere, so you can remove NetInfo?
Please let me know your opinion @fungilation.
@glCoder8 i use Netinfo.isConnected....but it undefined....not networkAvailable
@hustlercoder I mean, react-native-cached-image component using NetInfo for setting networkAvailable state value, but it's not used anywhere.
and I think you are getting error because you are using higher level of NetInfo package (maybe 3.x.x), but react-native-cached-image using NetInfo package 2.0.3.
to get rid of your issue, you need to use same version of NetInfo in your project, so it should be 2.0.3
@hustlercoder you are right , i have this issue as well, this module is still using NetInfo from react-native, here https://github.com/kfiroo/react-native-cached-image/blob/d7320ea3d36e6c99ff65cfd9c15b238b0f537f4c/CachedImage.js#L19
const {
View,
ImageBackground,
ActivityIndicator,
NetInfo,
Platform,
StyleSheet,
} = ReactNative;
Which is not correct because NetInfo got removed to it's own repo https://github.com/react-native-community/react-native-netinfo
this is why when i upgraded to react-native 0.60.10 i'me getting :
TypeError: Cannot read property isConnected of undefined
Is there any fixes?
@orcunorcun i think no...anyway i will try another package because for now there is nothing to do...
I got the same error =/
same issue. is there any fix for this issue?
I think they forgot that library. So someone should create a new npm package :/
you must change const { View, ImageBackground, ActivityIndicator, NetInfo, Platform, StyleSheet, } = ReactNative;
to
const { View, ImageBackground, ActivityIndicator, Platform, StyleSheet, } = ReactNative;
const NetInfo = require('@react-native-community/netinfo'); in node-module/react-native-cached-image/CachedImage.js
you must change const { View, ImageBackground, ActivityIndicator, NetInfo, Platform, StyleSheet, } = ReactNative;
to
const { View, ImageBackground, ActivityIndicator, Platform, StyleSheet, } = ReactNative;
const NetInfo = require('@react-native-community/netinfo'); in node-module/react-native-cached-image/CachedImage.js
Another for https://github.com/ds300/patch-package