Skip to content

Commit

Permalink
Add key to image to make sure it is reloaded when cached
Browse files Browse the repository at this point in the history
  • Loading branch information
hhravn committed May 19, 2017
1 parent 6cd0385 commit fff0c9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CachedImage.js
Expand Up @@ -153,6 +153,7 @@ const CachedImage = React.createClass({
} : this.props.source;
return this.props.renderImage({
...props,
key: props.key || source.uri,
style,
source
});
Expand All @@ -169,7 +170,7 @@ const CachedImage = React.createClass({

// if the imageStyle has borderRadius it will break the loading image view on android
// so we only show the ActivityIndicator
if (Platform.OS === 'android' && flattenStyle(imageStyle).borderRadius) {
if (!source || (Platform.OS === 'android' && flattenStyle(imageStyle).borderRadius)) {
return (
<ActivityIndicator
{...activityIndicatorProps}
Expand All @@ -180,6 +181,7 @@ const CachedImage = React.createClass({
return this.props.renderImage({
...imageProps,
style: imageStyle,
key: source.uri,
source,
children: (
<ActivityIndicator
Expand Down

0 comments on commit fff0c9d

Please sign in to comment.