Skip to content

Commit

Permalink
Back out "Add plumbing/boilerplate for an iOS implementation of the `…
Browse files Browse the repository at this point in the history
…gotpointercapture` and `lostpointercapture` events" (facebook#37861)

Summary:
Pull Request resolved: facebook#37861

Changelog: [Internal] - Back out of "Add plumbing/boilerplate for an iOS implementation of the `gotpointercapture` and `lostpointercapture` events"

Original commit changeset: c9da5691d399

Original Phabricator Diff: D44977499

This diff appears to be causing issues as reported on T155721480 related to the file `RawPropsKeyMap.cpp` which, while I haven't figured out exactly why this is occurring, confirmed that this diff is causing the issue. In order to buy myself some more time as I diagnose this I'm backing the changes out in this diff.

Reviewed By: adanoff

Differential Revision: D46691035

fbshipit-source-id: 383b46732a3fad24a50e18ab948c96ce9bfe429e
  • Loading branch information
vincentriemer authored and facebook-github-bot committed Jun 13, 2023
1 parent a53e81e commit 9e50185
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ type PointerEventProps = $ReadOnly<{|
onPointerOverCapture?: ?(e: PointerEvent) => void,
onPointerOut?: ?(e: PointerEvent) => void,
onPointerOutCapture?: ?(e: PointerEvent) => void,
onGotPointerCapture?: ?(e: PointerEvent) => void,
onLostPointerCapture?: ?(e: PointerEvent) => void,
|}>;

type FocusEventProps = $ReadOnly<{|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ const bubblingEventTypes = {
bubbled: 'onPointerOut',
},
},
topGotPointerCapture: {
phasedRegistrationNames: {
captured: 'onGotPointerCaptureCapture',
bubbled: 'onGotPointerCapture',
},
},
topLostPointerCapture: {
phasedRegistrationNames: {
captured: 'onLostPointerCaptureCapture',
bubbled: 'onLostPointerCapture',
},
},
};

const directEventTypes = {
Expand Down Expand Up @@ -378,8 +366,6 @@ const validAttributesForEventProps = ConditionallyIgnoredEventHandlers({
onPointerLeave: true,
onPointerOver: true,
onPointerOut: true,
onGotPointerCapture: true,
onLostPointerCapture: true,
});

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/react-native/React/Views/RCTView.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,5 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
@property (nonatomic, assign) RCTCapturingEventBlock onPointerLeave;
@property (nonatomic, assign) RCTBubblingEventBlock onPointerOver;
@property (nonatomic, assign) RCTBubblingEventBlock onPointerOut;
@property (nonatomic, assign) RCTBubblingEventBlock onGotPointerCapture;
@property (nonatomic, assign) RCTBubblingEventBlock onLostPointerCapture;

@end
2 changes: 0 additions & 2 deletions packages/react-native/React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,5 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_EXPORT_VIEW_PROPERTY(onPointerLeave, RCTCapturingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onPointerOver, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onPointerOut, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onGotPointerCapture, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onLostPointerCapture, RCTBubblingEventBlock)

@end
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,4 @@ void TouchEventEmitter::onPointerOut(const PointerEvent &event) const {
RawEvent::Category::ContinuousStart);
}

void TouchEventEmitter::onGotPointerCapture(const PointerEvent &event) const {
dispatchPointerEvent(
"gotPointerCapture",
event,
EventPriority::AsynchronousBatched,
RawEvent::Category::ContinuousStart);
}

void TouchEventEmitter::onLostPointerCapture(const PointerEvent &event) const {
dispatchPointerEvent(
"lostPointerCapture",
event,
EventPriority::AsynchronousBatched,
RawEvent::Category::ContinuousEnd);
}

} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class TouchEventEmitter : public EventEmitter {
void onPointerLeave(PointerEvent const &event) const;
void onPointerOver(PointerEvent const &event) const;
void onPointerOut(PointerEvent const &event) const;
void onGotPointerCapture(PointerEvent const &event) const;
void onLostPointerCapture(PointerEvent const &event) const;

private:
void dispatchTouchEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ struct ViewEvents {
PointerOutCapture = 29,
Click = 30,
ClickCapture = 31,
GotPointerCapture = 32,
GotPointerCaptureCapture = 33,
LostPointerCapture = 34,
LostPointerCaptureCapture = 35,
};

constexpr bool operator[](const Offset offset) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,30 +616,6 @@ static inline ViewEvents convertRawProp(
"onClickCapture",
sourceValue[Offset::ClickCapture],
defaultValue[Offset::ClickCapture]);
result[Offset::GotPointerCapture] = convertRawProp(
context,
rawProps,
"onGotPointerCapture",
sourceValue[Offset::GotPointerCapture],
defaultValue[Offset::GotPointerCapture]);
result[Offset::GotPointerCaptureCapture] = convertRawProp(
context,
rawProps,
"onGotPointerCaptureCapture",
sourceValue[Offset::GotPointerCaptureCapture],
defaultValue[Offset::GotPointerCaptureCapture]);
result[Offset::LostPointerCapture] = convertRawProp(
context,
rawProps,
"onLostPointerCapture",
sourceValue[Offset::LostPointerCapture],
defaultValue[Offset::LostPointerCapture]);
result[Offset::LostPointerCaptureCapture] = convertRawProp(
context,
rawProps,
"onLostPointerCaptureCapture",
sourceValue[Offset::LostPointerCaptureCapture],
defaultValue[Offset::LostPointerCaptureCapture]);

// PanResponder callbacks
result[Offset::MoveShouldSetResponder] = convertRawProp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ function PointerEventCaptureMouseTestCase(
const pointermoveNoCaptureGot1Ref = useRef(false);
const ownEventForTheCapturedTargetGotRef = useRef(false);

const testGotPointerCapture = harness.useAsyncTest(
'gotpointercapture event received"',
);
const testLostPointerCapture = harness.useAsyncTest(
'lostpointercapture event received"',
);
// const testGotPointerCapture = harness.useAsyncTest(
// 'gotpointercapture event received"',
// );
// const testLostPointerCapture = harness.useAsyncTest(
// 'lostpointercapture event received"',
// );

const handleCaptureButtonDown = useCallback((evt: PointerEvent) => {
const target0 = target0Ref.current;
Expand All @@ -50,20 +50,20 @@ function PointerEventCaptureMouseTestCase(
}
}, []);

const handleTarget0GotPointerCapture = useCallback(
(evt: PointerEvent) => {
testGotPointerCapture.done();
},
[testGotPointerCapture],
);

const handleTarget0LostPointerCapture = useCallback(
(evt: PointerEvent) => {
testLostPointerCapture.done();
isPointerCaptureRef.current = false;
},
[testLostPointerCapture],
);
// const handleTarget0GotPointerCapture = useCallback(
// (evt: PointerEvent) => {
// testGotPointerCapture.done();
// },
// [testGotPointerCapture],
// );

// const handleTarget0LostPointerCapture = useCallback(
// (evt: PointerEvent) => {
// testLostPointerCapture.done();
// isPointerCaptureRef.current = false;
// },
// [testLostPointerCapture],
// );

const testPointerMove0 = harness.useAsyncTest(
'pointerover event for black rectangle received',
Expand Down Expand Up @@ -150,8 +150,8 @@ function PointerEventCaptureMouseTestCase(
<View style={styles.container}>
<View
ref={target0Ref}
onGotPointerCapture={handleTarget0GotPointerCapture}
onLostPointerCapture={handleTarget0LostPointerCapture}
// onGotPointerCapture={handleTarget0GotPointerCapture}
// onLostPointerCapture={handleTarget0LostPointerCapture}
onPointerMove={handleTarget0PointerMove}
style={styles.target0}
/>
Expand Down

0 comments on commit 9e50185

Please sign in to comment.