diff --git a/CachedImage.js b/CachedImage.js
index daf03c8..69e6f43 100644
--- a/CachedImage.js
+++ b/CachedImage.js
@@ -16,11 +16,12 @@ const {
View,
ImageBackground,
ActivityIndicator,
- NetInfo,
Platform,
StyleSheet,
} = ReactNative;
+import NetInfo from "@react-native-community/netinfo";
+
const styles = StyleSheet.create({
image: {
backgroundColor: 'transparent'
@@ -36,7 +37,7 @@ const styles = StyleSheet.create({
});
function getImageProps(props) {
- return _.omit(props, ['source', 'defaultSource', 'fallbackSource', 'LoadingIndicator', 'activityIndicatorProps', 'style', 'useQueryParamsInCacheKey', 'renderImage', 'resolveHeaders']);
+ return _.omit(props, ['source', 'defaultSource', 'fallbackSource', 'loadingIndicator', 'activityIndicatorProps', 'style', 'useQueryParamsInCacheKey', 'renderImage', 'resolveHeaders']);
}
const CACHED_IMAGE_REF = 'cachedImage';
@@ -79,9 +80,9 @@ class CachedImage extends React.Component {
componentWillMount() {
this._isMounted = true;
- NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange);
+ NetInfo.addEventListener(this.handleConnectivityChange);
// initial
- NetInfo.isConnected.fetch()
+ NetInfo.fetch()
.then(isConnected => {
this.safeSetState({
networkAvailable: isConnected
@@ -93,7 +94,6 @@ class CachedImage extends React.Component {
componentWillUnmount() {
this._isMounted = false;
- NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange);
}
componentWillReceiveProps(nextProps) {
@@ -199,14 +199,14 @@ class CachedImage extends React.Component {
if (LoadingIndicator) {
return (
-
+
);
}
return (
+ style={[imageStyle, activityIndicatorStyle]} color="#063f71"/>
);
}
// otherwise render an image with the defaultSource with the ActivityIndicator on top of it
@@ -218,11 +218,11 @@ class CachedImage extends React.Component {
children: (
LoadingIndicator
?
-
+
:
+ style={activityIndicatorStyle} color="#063f71"/>
)
});
}