-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[0.77] Fix Android Image defaultSource runtime error (#49097)
#49890
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
Conversation
Summary: Fixes facebook#49075 The Image `defaultSource` prop is causing a runtime error from 0.77 just by using it in the Image component (see error in the linked issue). This might be a regression from some changes in the prop processing logic from either facebook#47710, facebook#47713 or facebook#47754. ## Changelog: [ANDROID] [FIXED] - Fix Image defaultSource runtime error Pull Request resolved: facebook#49097 Test Plan: - Verify it doesn't throw any error on runtime anymore for Android. - iOS behaviour should not be impacted as changes are Android specific In the RNTester, you can use the following component: ```tsx import * as React from 'react'; import {Image, View} from 'react-native'; function Playground() { return ( <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}> <Image defaultSource={require('../../assets/bandaged.png')} source={{ uri: 'https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_4x3.jpg', }} style={{width: 200, height: 200}} /> </View> ); } ``` Also, this `defaultSource` prop is ignored in debug builds for Android ([as per the docs](https://reactnative.dev/docs/image#defaultsource)) – but I've verified we get the defaultSource as a string, which is what we expect on the native side: <details> <summary>Screenshot of the Android logs</summary>  </details> Reviewed By: javache Differential Revision: D69052723 Pulled By: cortinico fbshipit-source-id: 2860dd4c18cefcfcbc4e39f94dfa6305f45773a3 # Conflicts: # packages/react-native/Libraries/Image/ImageViewNativeComponent.js
|
Hi @fbp93! 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 cla@meta.com. Thanks! |
|
@fbp93 can you also sign the CLA here: https://code.facebook.com/cla ? |
I signed the individual one, is it enough? The company one was asking for contact points etc that I don't have |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
defaultSource runtime error (#49097)defaultSource runtime error (#49097)
Summary:
Fixes #49075
The Image
defaultSourceprop is causing a runtime error from 0.77 just by using it in the Image component (see error in the linked issue). This might be a regression from some changes in the prop processing logic from either #47710, #47713 or #47754.Changelog:
[ANDROID] [FIXED] - Fix Image defaultSource runtime error
Pull Request resolved: #49097
Test Plan:
In the RNTester, you can use the following component:
Also, this
defaultSourceprop is ignored in debug builds for Android (as per the docs) – but I've verified we get the defaultSource as a string, which is what we expect on the native side:Screenshot of the Android logs
Reviewed By: javache
Differential Revision: D69052723
Pulled By: cortinico
fbshipit-source-id: 2860dd4c18cefcfcbc4e39f94dfa6305f45773a3
Conflicts:
packages/react-native/Libraries/Image/ImageViewNativeComponent.js
Summary:
Changelog:
Test Plan: