-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Image & ListView] Image in ListView is not updated when re-rendering #1417
Comments
It's not a comparison problem, because even the shallow comparison would return false, given you are creating different object instances on every render. So I'm afraid that's not the issue. I think in #1397 @ide mentioned there might be some bug in the Image class that causes Images not to change, might want to check that. |
Have same issue, dataSource updated, row change is triggered and text updated but image does not rerender with new url |
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
@adrian-social-prod It does work, but it recreates the entire image view. This might not be problematic for 1 image, but for a few dozen it starts to become costly. |
is still a problem in 0.8.0. list view image does not change when a new item is added to list unless the 'key' param is used to force the image to rerender. list is inside a TabBar item. Seems like a major problem to me. |
Hi there! This issue is being closed because it has been inactive for a while. But don't worry, it will live on with ProductPains! Check out it's new home: https://productpains.com/post/react-native/image-listview-image-in-listview-is-not-updated-when-re-rendering |
Any chance I can reopen this? |
Please re-open - I still have the issue with RN 0.28. It only seems to be a problem under certain circumstances. For me it happens when: An image is added to the end of the list, AND it is adjacent in the list to another image. Adding |
@npomfret: Were you able to fix the issue? I actually run into the same problem as yours. I'm using RN 0.30. |
might try |
Any updates on this? So far only hacking the
Not sure if requiring image within a loop is efficient though. |
You can just require the images at the top @carera |
@merielleimpreso i don't have a 'proper' fix, but hacking the key={uri} worked around it |
I'm having the same issue, but hacking the key={uri} also worked for me. |
I don't think this should be closed. Images in ListViews don't re-render when you change the uri props. Feels like a proper bug. |
I had a similar issue: every time I added a new element to the list, it did not populate the new "graphical row" with the correct data (even if in the state are correct) but with a copy of the first row. Adding the |
This is happening to me as well on 0.38. After updating the Update: this is not specific to |
Yes seeing the same problem as well. This ticket shouldn't be closed. |
same issue |
So it is open? |
I just ran into this. I'm rendering an image using a remote URL, provided by my components initial state. Some UI actions can cause the URL that's store in component state to update. If I render the URL using a EDIT: After taking a closer look at the URL being returned from my API, I noticed it's an |
I join the question of @hugomosh |
@hugomosh @jose920405 I've also been experiencing this issue with FlatList :/ |
I've this issue with FlatList too... |
I'm also experiencing this issue with Flatlist |
+1 |
RN 54.4 still happening Same, when using the FlatList and adding a If I change the amount of rows in the FlatList or make a few further changes to the data in the FlatList then the new data will appear. I think this has something to do with the row in the FlatList not completely being redrawn maybe? Maybe iterators are caching image resources until the row is completely redrawn. Something I am doing for now as a workaround is using the pull to refresh. I don't love it but it is the only thing that kind of works for the user experience right now.
basically emptying and refilling the data when a user pulls down to refresh the list. |
Someone on StackOverflow report that if you don't set the size on the image, it will re-render correctly. This fix didn't work for me but I'm posting it here for others just in case. https://stackoverflow.com/questions/37529211/react-native-image-wont-rerender-when-state-changes |
Using react-native-image-cache instead of Image component solved this issue for me. Maybe related to kfiroo/react-native-cached-image#26 |
@alexandretournier may not be used. |
thanks @Asadallahi |
Say I have such row in ListView
When the state changes, the
Text
's are re-rendered but theImage
isn't. The lastText
shows that theavatarUrl
is updated correctly. However, theImage
still shows the old picture.I'm wondering if this is due to
Image
doesn't compare{uri: xxx}
deeply?Thanks
The text was updated successfully, but these errors were encountered: