react-native-cacheable-image
react-native-cacheable-image copied to clipboard
Not refreshing when URL changes
I have a CacheableImage component in my view. When the URL changes (via a redux reducer), the image is not getting updated. I've confirmed that the view itself is getting re-rendered with the new URL. If I replace CacheableImage with Image, it works as expected.
I checked the code and see that you are handling the source change via componentWillReceiveProps so I'm confused as to why it's not working. Any thoughts or suggestions?
Does your image is rendered inside a ListView ? If yes, take a look at this issue https://github.com/facebook/react-native/issues/1417
@ryanhomer I experienced the same issue and after adding a key prop with the image URI it worked.
@Crash-- @eneskaya Thanks for the responses. I ended up using react-native-cached-image instead which fixed the issue for me but I was not using the key property so, good to know.
The solution of the key worked for me
< CacheableImage source={{uri:object.image}} key={object.image_key} / >