-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
[iOS] Fabric: Support defaultSource prop of Image component #46554
base: main
Are you sure you want to change the base?
[iOS] Fabric: Support defaultSource prop of Image component #46554
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small nits to update.
I'm not super familiar with the Image logic, once we fix the nits, I'll import it and ask for few more people to have a look at it.
if (strongSelf) { | ||
if (!strongSelf->_imageView.image) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (strongSelf) { | |
if (!strongSelf->_imageView.image) { | |
if (strongSelf && !strongSelf->_imageView.image) { |
but what if we have an image
already? I mean, what happens if we change the imageSource prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have an image already, we would not reset default image and just only to load new image source. The same logic as old arch.
RCTImageComponentView *strongSelf = weakSelf; | ||
if (strongSelf) { | ||
if (!strongSelf->_imageView.image) { | ||
strongSelf->_imageView.image = finalImage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we emit an OnLoadEnd
event here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as old arch, we only fire image load events for image source.
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary:
We missed
defaultSource
support of Image in Fabric, so let's add it.Changelog:
[IOS] [FIXED] - Fabric: Support defaultSource prop of Image component
Test Plan:
RNTester Image
defaultSource
example worked in Fabric.