Skip to content

Wire pointer capture event props through the Fabric view config#57301

Open
yaminyassin wants to merge 1 commit into
react:mainfrom
yaminyassin:w3c-pointer-1-view-config
Open

Wire pointer capture event props through the Fabric view config#57301
yaminyassin wants to merge 1 commit into
react:mainfrom
yaminyassin:w3c-pointer-1-view-config

Conversation

@yaminyassin

@yaminyassin yaminyassin commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

On Fabric those two handlers went nowhere. The view config listed their names, so JS could pass them without an error, but the C++ renderer never read them. propsConversions.h had a literal // TODO: gotPointerCapture & lostPointerCapture where the parsing belonged. The renderer decides whether to deliver a pointer event by checking a per-listener bit on the view's props. When a handler is never parsed, that bit stays off, so the event has nowhere to land no matter what the component passed. The capture-phase variants of the other pointer events were missing from the view config the same way, and Android was also missing a few of the plain bubble-phase attributes.

This change fills in that plumbing. It is the recognition layer for the W3C setPointerCapture / releasePointerCapture work. These props do not dispatch anything on their own. They let the renderer see that a listener exists, so the capture events have somewhere to go.

The two platforms diverge after that point. On iOS pointer events run through the C++ PointerEventsProcessor, which reads these bits, so the capture events fire once the props are parsed. On Android pointer events are assembled in Java and never reach that processor, so the handler names are registered but nothing emits gotpointercapture or lostpointercapture from this change. The Android emission path is separate work and is not part of this branch.

What it touches:

  • propsConversions.h. Replaces the TODO with convertRawProp calls for onGotPointerCapture, onGotPointerCaptureCapture, onLostPointerCapture, and onLostPointerCaptureCapture. This is the non-iterator parsing path.
  • primitives.h and BaseViewProps.cpp. Adds two capture-phase offsets, GotPointerCaptureCapture (38) and LostPointerCaptureCapture (39), with their setProp cases. This is the iterator path that runs under enableCppPropsIteratorSetter, so both parsing paths now agree.
  • BaseViewConfig.ios.js and BaseViewConfig.android.js. Adds the capture-phase validAttributes for every pointer event plus the got/lost-capture entries. Android also picks up the bubble-phase onPointerDown, onPointerUp, and onPointerCancel attributes it was missing.
  • BaseViewManager.java. Registers topGotPointerCapture and topLostPointerCapture as bubbling event types so they reach JS handlers. This path covers useNativeViewConfigsInBridgelessMode.
  • scripts/cxx-api/api-snapshots/*.api. Records the two new ViewEvents::Offset values. The enum is part of the tracked C++ API, so the snapshots move with it and validate-cxx-api-snapshots stays green.

Changelog:

[General] [Added] - Recognize onGotPointerCapture / onLostPointerCapture and the capture-phase pointer event handlers in the Fabric view config

Test Plan:

Static checks, verified against the diff:

  • Both Fabric parsing paths cover the same pointer offsets, so props parse the same way under either value of enableCppPropsIteratorSetter.
  • The two new offsets (38, 39) fit inside the std::bitset<64> backing ViewEvents.
  • The iOS and Android validAttributes carry the same capture-phase handlers.
  • The two new ViewEvents::Offset values are added to the committed C++ API snapshots in sorted position, so validate-cxx-api-snapshots stays in sync with the enum.

Format: prettier --check passes on the changed BaseViewConfig.{ios,android}.js. Flow, TypeScript, and the C++ API snapshot validation run in CI.

Behavior:

This change only adds prop recognition, so it has no runtime event of its own to assert.

Fabric declared onGotPointerCapture / onLostPointerCapture and the capture-phase pointer handlers in its view config, but never parsed them.

Fill in both prop parsing paths (convertRawProp and the iterator setProp), add the two missing capture phase offsets, and register the got/lost-capture bubbling event types and validAttributes on iOS and Android. Android was also missing the bubble-phase onPointerDown, onPointerUp and onPointerCancel attributes.
@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 Jun 21, 2026
@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 Jun 21, 2026
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