Repository navigation
Conversation
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.
|
Hi @mogretici! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
On the New Architecture, a View's
onMagicTaphandler never runs on iOS. A VoiceOver two-finger double tap on the view does nothing.The cause is a prop-name mismatch:
onMagicTap. SeeLibraries/Components/View/ViewPropTypes.jsandLibraries/NativeComponent/BaseViewConfig.ios.js, wheretopMagicTaphasregistrationName: 'onMagicTap'andvalidAttributescontainsonMagicTap: true. So the raw prop that reaches Fabric isonMagicTap.AccessibilityPropsreads the flag fromonAccessibilityMagicTapinstead, both in the constructor (convertRawProp(..., "onAccessibilityMagicTap", ...)) and insetProp(RAW_SET_PROP_SWITCH_CASE_BASIC(onAccessibilityMagicTap), which keys on the field name). As a resultonAccessibilityMagicTapstaysfalse.RCTViewComponentView'saccessibilityPerformMagicTapchecks_props->onAccessibilityMagicTap, so it always returnsNO, and the event emitter'sonAccessibilityMagicTap()is never called.The legacy renderer is not affected:
RCTViewManagerremapsonMagicTapdirectly. The sibling props (onAccessibilityTap,onAccessibilityEscape,onAccessibilityAction) already use matching names.This change reads the flag from
onMagicTapin both parsing paths. The C++ field name and the event emitter are unchanged.Changelog:
[IOS] [FIXED] -
onMagicTapnow fires for VoiceOver's magic tap on the New ArchitectureTest Plan:
AccessibilityPropsTest.reads_magic_tap_listener_from_on_magic_tap. It parses{ onMagicTap: true }throughViewProps, the same way the existing tests in that file do, and expectsonAccessibilityMagicTapto betrue. Without this change the flag isfalse. I could not run the ReactCommon gtest suite locally; it isn't wired into the OSS CI.main(0941e95) and on the v0.86.3, v0.87.0 and v0.88.0 tags; all four have the same code.onMagicTapin 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.