Wire pointer capture event props through the Fabric view config#57301
Open
yaminyassin wants to merge 1 commit into
Open
Wire pointer capture event props through the Fabric view config#57301yaminyassin wants to merge 1 commit into
yaminyassin wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.hhad a literal// TODO: gotPointerCapture & lostPointerCapturewhere 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/releasePointerCapturework. 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 emitsgotpointercaptureorlostpointercapturefrom this change. The Android emission path is separate work and is not part of this branch.What it touches:
propsConversions.h. Replaces the TODO withconvertRawPropcalls foronGotPointerCapture,onGotPointerCaptureCapture,onLostPointerCapture, andonLostPointerCaptureCapture. This is the non-iterator parsing path.primitives.handBaseViewProps.cpp. Adds two capture-phase offsets,GotPointerCaptureCapture(38) andLostPointerCaptureCapture(39), with theirsetPropcases. This is the iterator path that runs underenableCppPropsIteratorSetter, so both parsing paths now agree.BaseViewConfig.ios.jsandBaseViewConfig.android.js. Adds the capture-phasevalidAttributesfor every pointer event plus the got/lost-capture entries. Android also picks up the bubble-phaseonPointerDown,onPointerUp, andonPointerCancelattributes it was missing.BaseViewManager.java. RegisterstopGotPointerCaptureandtopLostPointerCaptureas bubbling event types so they reach JS handlers. This path coversuseNativeViewConfigsInBridgelessMode.scripts/cxx-api/api-snapshots/*.api. Records the two newViewEvents::Offsetvalues. The enum is part of the tracked C++ API, so the snapshots move with it andvalidate-cxx-api-snapshotsstays green.Changelog:
[General] [Added] - Recognize
onGotPointerCapture/onLostPointerCaptureand the capture-phase pointer event handlers in the Fabric view configTest Plan:
Static checks, verified against the diff:
enableCppPropsIteratorSetter.std::bitset<64>backingViewEvents.validAttributescarry the same capture-phase handlers.ViewEvents::Offsetvalues are added to the committed C++ API snapshots in sorted position, sovalidate-cxx-api-snapshotsstays in sync with the enum.Format:
prettier --checkpasses on the changedBaseViewConfig.{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.