Fix callbacks not being fired on macOS ActionSheetIOS #1830
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary
Resolves #1680
On macOS, we implement ActionSheetIOS to be an NSMenu (not confusing at all). During the 0.71 merge,
RCTActionSheetManager.mm
was refactored a bit, and the macOS implementation wasn't properly updated. Thus, callbacks wouldn't get fired when you clicked on menu items.While the fix is simple (initialize
_callbacks
on init), I decided to go ahead and refactor the diffs so that the iOS and macOS blocks are much closer to each other and share more code. I also added a few comments explaining some macOS differences we needed. This should help ensure that future merges are less likely to break this module.Things to note:
Changeling
[MACOS] [FIXED] - Fix callbacks not being fired on macOS ActionSheetIOS
Test Plan
See video. Before, clicking any menu item would result in a warning that no callback is registered.
Screen.Recording.2023-05-25.at.12.34.53.PM.mov