-
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
Fix Image defaultSource not showing on iOS #32172
Conversation
Fix Image defaultSource not showing on iOS. This bug was introduced somewhere between RN 0.63 and 0.65. On iOS, defaultSource does not show while the image is being downloaded, only if it fails or there's no internet.
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Base commit: d4c347c |
Base commit: d4c347c |
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@cristianoccazinsp Do you think you could also put together a RNTester example of this behavior to ensure we don't break it again? We can add some E2E testing around it internally |
@lunaleaps this is my first PR ever to RN so I wouldn't even know where to start! In fact, I'm not 100% sure this is the right place to fix this issue. When debugging, the issue is clear, the default image is never loaded by default unless there's a network error, so the fix made sense in this location. However, who ever changed this last may have more idea if this is the right place to add the "load default image" code. Either way, if you could point me where to start with a RNTester change, I could try. |
Gotcha Yea basically you want to create a reproduction of the issue you were seeing and stick it as an example in here:
Have you run RNTester before? Here are the instructions to run in this repo: https://github.com/facebook/react-native/tree/1465c8f3874cdee8c325ab4a4916fda0b3e43bdb/packages/rn-tester#running-this-app Once you have that app running, you can navigate to the Image examples. |
The test was simple, defaultSource simply does not work on iOS and RN 0.65.1; it doesn’t work at all unless you run the app without internet connectivity. It also has the caveat that if you must run this in release mode as without internet not even the default source image will work (because resources are downloaded from the host when in debug mode) |
@cristianoccazinsp Got it, then maybe just adding an image with a default source is sufficient to RNTester. |
I will give it a try once I get some free time, although most likely out of scope for me. Any chance someone with more knowledge of this code can take a look as well to make sure I changed what I was supposed to? |
@lunaleaps I made the effort to test the rn-tester app image section. I believe images with I made a slight tweak to the test so it loads a larger image and also busts cache in order to ensure the I have also confirmed that my PR fixes the issue, and it was otherwise broken without the native iOS change. However, I don't know how are you going to ensure this is tested and detected if it breaks again. Lastly, and perhaps material for another PR, there are various unhandled promise rejection logs and warnings, the code doesn't seem to be bug-free. |
@lunaleaps any updates on this? Think this can make its way up to the next RN version? What's missing? Thanks! |
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Does this mean it was included in a following release, or just ignored? |
@cristianoccazinsp it was commited in 900210c and it will be included in the next release. |
Summary
Fix Image defaultSource not showing on iOS.
This bug was introduced somewhere between RN 0.63 and 0.65. On iOS, defaultSource does not show while the image is being downloaded, only if it fails or there's no internet.
Changelog
[iOS] [Fixed] - Fix Image defaultSource not showing on iOS
Test Plan
Ran both debug and release builds on an iPhone 12 pro (iOS 14.6)