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

Not refreshing when URL changes

Open techrah opened this issue 8 years ago • 4 comments

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?

techrah avatar Mar 14 '17 15:03 techrah

Does your image is rendered inside a ListView ? If yes, take a look at this issue https://github.com/facebook/react-native/issues/1417

Crash-- avatar Mar 21 '17 15:03 Crash--

@ryanhomer I experienced the same issue and after adding a key prop with the image URI it worked.

eneskaya avatar Apr 05 '17 11:04 eneskaya

@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.

techrah avatar Apr 06 '17 13:04 techrah

The solution of the key worked for me

< CacheableImage source={{uri:object.image}} key={object.image_key} / >

mekoahdd avatar Oct 31 '17 21:10 mekoahdd