react-native-cached-image icon indicating copy to clipboard operation
react-native-cached-image copied to clipboard

Netinfo error

Open hustlercoder opened this issue 6 years ago • 11 comments

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.

hustlercoder avatar Jul 15 '19 10:07 hustlercoder

I think networkAvailable flag is not used anywhere, so you can remove NetInfo? Please let me know your opinion @fungilation.

glCoder8 avatar Jul 17 '19 19:07 glCoder8

@glCoder8 i use Netinfo.isConnected....but it undefined....not networkAvailable

hustlercoder avatar Jul 18 '19 14:07 hustlercoder

@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

glCoder8 avatar Jul 18 '19 16:07 glCoder8

@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

elhachimi avatar Jul 24 '19 15:07 elhachimi

Is there any fixes?

orcunorcun avatar Aug 01 '19 08:08 orcunorcun

@orcunorcun i think no...anyway i will try another package because for now there is nothing to do...

hustlercoder avatar Aug 07 '19 07:08 hustlercoder

I got the same error =/

OtacilioN avatar Aug 07 '19 18:08 OtacilioN

same issue. is there any fix for this issue?

russelRajitha avatar Aug 20 '19 10:08 russelRajitha

I think they forgot that library. So someone should create a new npm package :/

orcunorcun avatar Aug 23 '19 02:08 orcunorcun

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

wandhi avatar Sep 25 '19 03:09 wandhi

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

hueyAtFetchly avatar Aug 28 '20 21:08 hueyAtFetchly