-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Images fail to render after a certain number are added to the page [Android, RN 0.36] #10569
Comments
@Cxxxx100 - can you repro this on the latest version and ensure that it is still happening? |
hi, |
@brentvatne I just tested on RN 0.36 and the issue is still happening. I'll update the title and description. |
I had the same problem |
I also had same problem. But I find out solution. I resize the original image size less 100 KB. I check it in my sample project by using 1000 images and it works find. |
@janaka120 thanks for a tip but it did not work in our case. But it pointed us to in a right direction. It looks like the problem is when pictures has to be down-scaled. There were similar issues with PNG before and this looks quite similar. |
@marxsk Thanks for the suggestion, but this did not work for me. I tried updating my code to use the original image size (420x420) however after a certain number of images they still fail to render. |
Of course keeping small images is good but the Image component should handle this memory leak as well. @Cxxxx100 you said that using webview it works fine. In my case I'm using the prefetch to cache the image. Do you know if there's a way to keep the images in cache to load in the webviews? |
@andreyluiz I'm not sure if there is a way to keep the images in cache to load in the webview. In my case I'm not prefetching the images. Also, @brentvatne should the "Needs more information" label be removed? I added the information you requested. |
@janaka120 I followed your tip and it worked. But I have 10 images only. How many images are you handling? Do you know if just reducing the size makes a list of 100 images, for example, render with no problems? EDIT: since my images are uploaded in a Node.js server, I created a combination of image-size + sharp + image-min to resize and optimize my images. I will do that by now, but I will keep watching for news about this memory leak. |
I have the same problem,I loaded many product list image after about 40 image loaded, then image stop load more pictures. Only on android |
Can somebody investigate the correlation of this issue to memory usage? I suspect that images may stop working when reaching a limit on available memory. |
cc @AaaChiuuu who may have more context on this (Or Aaron, feel free to cc somebody else) |
Oh yeah, I'm getting this. But not a single image renders. My issue, I think, it's related to image size and resize. Im on |
I was stepping into the React Native Java code today and saw the following exception being caught here: https://github.com/facebook/fresco/blob/master/imagepipeline/src/main/java/com/facebook/imagepipeline/datasource/AbstractProducerToDataSourceAdapter.java#L57
Seems related to this issue: #11326 It's interesting that this error is being swallowed up and I'm not seeing it in adb logcat. Is there a verbose logging mode I'd need to enable to see it? I'm already doing setUseDeveloperSupport(true) |
I hava the same problem on rn0.40 for android,but ,when I set "resizeMethod='resize'" in Image ,it's ok |
@hxkuan Doesn't work for me: No matter what I do. |
Hi guys! I have the same problem and I saw this article: React Native on Android — Lessons Learned I tried some recommendations and it seems to work well. |
export default class Demo extends Component{ |
Still happening on 0.42. I wonder whether it will be ever solved since a lot of applications cannot go to production with this bug ... My application uses 574 images of total size 16MB. |
This is logged in android device monitor for every picture that failed to render: |
This issue is still reproducible on react native 0.44.0. Can somebody that worked with Fresco issues give some insights or advice? Sorry in advance for tagging ;) ... @narychen @oprisnik @fab1an @balazsbalazs |
I guess something is holding on to the images so that they are kept in memory. Maybe view recycling doesn't work correctly for the |
I agree with @oprisnik. On android you should adding removeClippedSubviews={true} to ListView or you will be blocked to show any more images. On ios it is not needed. |
On the Scrollview adding removeClippedSubviews={true} solved the problem ... Thanks guys! |
|
removeClippedSubviews={true} |
Do we've to explicitly set it? Because the documentation says it's true by default |
What's funny is that if I turn on |
Thanks very much, |
I'm using ViewPagerAndroid, which hasn't |
check this answer. It might help. I solved the problem without using any third-party component. |
@oprisnik adding |
Description
I've written a simple RN app that displays a large number of images in a horizontal scroll view. After a certain number of images, they being to stop loading.
Reproduction
See code below, I've reproduced this on an android device, but it doesn't reproduce on iOS simulator. I haven't tried an iOS device or an Android simulator. Run the app and notice images stop loading about half way through the scroll view. See:
Additional Information
*If I load the same number of images in a webview, I don't run into the issue. So I think the issue is specific to the React Image component logic leaking memory and not just "Your app has too many images"
The text was updated successfully, but these errors were encountered: