-
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 action sheet callback invoked more than once on iPad #33099
Conversation
Base commit: f89a0b7 |
Base commit: f89a0b7 |
@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
// The handler for a button might get called more than once when tapping outside | ||
// the action sheet on iPad. RCTResponseSenderBlock can only be called once so | ||
// keep track of callback invocation here. | ||
__block bool callbackInvoked = false; |
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.
this is never set to true? the condition in L146 will always pass. am i missing something obvious?
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.
Oh you're right, my bad I removed it to test before / after and forgot to put it back -_-
@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @janicduplessis in 8935d6e. When will my fix make it into a release? | Upcoming Releases |
) Summary: iOS will sometimes invoke the UIAlertAction handler for the cancel button more than once on iPad. This can be reproduced relatively easily by having a button that opens an action sheet and spam tapping outside the action sheet while it is opening. Since native module callbacks can only be invoked once this causes the app to crash here https://github.com/facebook/react-native/blob/main/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm#L206. ## Changelog [iOS] [Fixed] - Fix action sheet callback invoked more than once on iPad Pull Request resolved: facebook#33099 Test Plan: Tested on iPad simulator to reproduce the crash and verified that this fixes it. Reviewed By: philIip Differential Revision: D34215327 Pulled By: ShikaSD fbshipit-source-id: 6f406e4df737a57e6dd702dd54260aa72eab31d6
Summary
iOS will sometimes invoke the UIAlertAction handler for the cancel button more than once on iPad. This can be reproduced relatively easily by having a button that opens an action sheet and spam tapping outside the action sheet while it is opening. Since native module callbacks can only be invoked once this causes the app to crash here https://github.com/facebook/react-native/blob/main/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm#L206.
Changelog
[iOS] [Fixed] - Fix action sheet callback invoked more than once on iPad
Test Plan
Tested on iPad simulator to reproduce the crash and verified that this fixes it.