Skip to content

Fix onMagicTap never reaching iOS views on the New Architecture - #59530

Open
mogretici wants to merge 1 commit into
react:mainfrom
mogretici:fix-fabric-magic-tap
Open

mogretici wants to merge 1 commit into
react:mainfrom
mogretici:fix-fabric-magic-tap

Conversation

@mogretici

Copy link
Copy Markdown

Summary:

On the New Architecture, a View's onMagicTap handler never runs on iOS. A VoiceOver two-finger double tap on the view does nothing.

The cause is a prop-name mismatch:

  • JS registers the listener as onMagicTap. See Libraries/Components/View/ViewPropTypes.js and Libraries/NativeComponent/BaseViewConfig.ios.js, where topMagicTap has registrationName: 'onMagicTap' and validAttributes contains onMagicTap: true. So the raw prop that reaches Fabric is onMagicTap.
  • AccessibilityProps reads the flag from onAccessibilityMagicTap instead, both in the constructor (convertRawProp(..., "onAccessibilityMagicTap", ...)) and in setProp (RAW_SET_PROP_SWITCH_CASE_BASIC(onAccessibilityMagicTap), which keys on the field name). As a result onAccessibilityMagicTap stays false.
  • RCTViewComponentView's accessibilityPerformMagicTap checks _props->onAccessibilityMagicTap, so it always returns NO, and the event emitter's onAccessibilityMagicTap() is never called.

The legacy renderer is not affected: RCTViewManager remaps onMagicTap directly. The sibling props (onAccessibilityTap, onAccessibilityEscape, onAccessibilityAction) already use matching names.

This change reads the flag from onMagicTap in both parsing paths. The C++ field name and the event emitter are unchanged.

Changelog:

[IOS] [FIXED] - onMagicTap now fires for VoiceOver's magic tap on the New Architecture

Test Plan:

  • Added AccessibilityPropsTest.reads_magic_tap_listener_from_on_magic_tap. It parses { onMagicTap: true } through ViewProps, the same way the existing tests in that file do, and expects onAccessibilityMagicTap to be true. Without this change the flag is false. I could not run the ReactCommon gtest suite locally; it isn't wired into the OSS CI.
  • I traced the mismatch on main (0941e95) and on the v0.86.3, v0.87.0 and v0.88.0 tags; all four have the same code.
  • I found it while wiring onMagicTap in an app on RN 0.86.3 (Expo SDK 57, New Architecture) and confirmed it by following the code path above. I have not verified the fix on a device, because that app uses the prebuilt RN core.

JS registers the magic tap listener under the prop name onMagicTap
(BaseViewConfig.ios.js), but AccessibilityProps read the flag from
onAccessibilityMagicTap, so the flag stayed false and
RCTViewComponentView's accessibilityPerformMagicTap always returned NO.
Read it from onMagicTap in both the constructor and setProp paths.
@meta-cla

meta-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Hi @mogretici!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
@meta-cla

meta-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant