-
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
feature: Update Image.getSize/getSizeWithHeaders
methods to return a promise
#42895
feature: Update Image.getSize/getSizeWithHeaders
methods to return a promise
#42895
Conversation
Image.getSize
method to return a promiseImage.getSize/getSizeWithHeaders
methods to return a promise
e54c366
to
c690ad9
Compare
This comment was marked as outdated.
This comment was marked as outdated.
/rebase - this commet will rebase the PR on top of main automatically. All these changes are JS changes only, there is no reason why the native builds should fail. Let's see if a rebase fixes CI. |
c690ad9
to
65fb75c
Compare
65fb75c
to
46bb41f
Compare
46bb41f
to
42bd4aa
Compare
Base commit: c1b8f37 |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
the |
I was looking into that. There is an internal E2E test that is failing and I need to understand why. I'll probably look into it tomorrow morning, as the day is almost over and I have another meeting coming up. :( |
This pull request was successfully merged by @retyui in 2c1bcba. When will my fix make it into a release? | Upcoming Releases |
Summary:
Image.getSize/getSizeWithHeaders
are still working in old fashioned "callback" wayBut in 2024 more developers prefer use async/await syntax for asynchronous operations
So, in this PR I added support for Promise API with backward compatibility, modern way:
Changelog:
[GENERAL] [ADDED] -
Image.getSize/getSizeWithHeaders
method returns a promise if you don't pass asuccess
callbackTest Plan:
a.
node_modules/react-native/Libraries/Image/Image.android.js
b.
node_modules/react-native/Libraries/Image/Image.ios.js