mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix pointer event dispatch to nested text nodes
Summary: Noticed that we weren't receiving pointer events for nested Text spans when the new pointer events implementation was enabled. Changelog: [Internal] Reviewed By: lunaleaps Differential Revision: D41496672 fbshipit-source-id: 9d0ed83d1bb5f42211ec655328035651f25fa471
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9c88dad7a2
commit
1b994732e4
@@ -250,10 +250,14 @@ public class JSPointerDispatcher {
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
dispatchCancelEvent(eventState, motionEvent, eventDispatcher);
|
||||
break;
|
||||
case MotionEvent.ACTION_HOVER_ENTER:
|
||||
case MotionEvent.ACTION_HOVER_EXIT:
|
||||
// These are handled by HOVER_MOVE
|
||||
break;
|
||||
default:
|
||||
FLog.w(
|
||||
ReactConstants.TAG,
|
||||
"Warning : Motion Event was ignored. Action=" + action + " Target=" + activeTargetTag);
|
||||
"Motion Event was ignored. Action=" + action + " Target=" + activeTargetTag);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class TouchTargetHelper {
|
||||
pathAccumulator = pathAccumulator.subList(firstReactAncestor, pathAccumulator.size());
|
||||
}
|
||||
|
||||
int targetTag = getTouchTargetForView(reactTargetView, eventX, eventY);
|
||||
int targetTag = getTouchTargetForView(reactTargetView, viewCoords[0], viewCoords[1]);
|
||||
if (targetTag != reactTargetView.getId()) {
|
||||
pathAccumulator.add(0, new ViewTarget(targetTag, (View) null));
|
||||
}
|
||||
@@ -396,11 +396,11 @@ public class TouchTargetHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private static int getTouchTargetForView(View targetView, float eventX, float eventY) {
|
||||
private static int getTouchTargetForView(View targetView, float viewX, float viewY) {
|
||||
if (targetView instanceof ReactCompoundView) {
|
||||
// Use coordinates relative to the view, which have been already computed by
|
||||
// {@link #findTouchTargetView()}.
|
||||
return ((ReactCompoundView) targetView).reactTagForTouch(eventX, eventY);
|
||||
return ((ReactCompoundView) targetView).reactTagForTouch(viewX, viewY);
|
||||
}
|
||||
return targetView.getId();
|
||||
}
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ public class PointerEventHelper {
|
||||
|
||||
public static boolean isListening(@Nullable View view, EVENT event) {
|
||||
if (view == null) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
|
||||
Reference in New Issue
Block a user