Add emitting view to onChildStartedNativeGesture callback

Summary:
Changelog:
[Android][Changed] RootView's onChildStartedNativeGesture now takes the child view as its first argument

Reviewed By: philIip

Differential Revision: D31399515

fbshipit-source-id: b9438f6118e604a04799ef67d0b46303a06d6434
This commit is contained in:
Pieter De Baets
2021-10-21 03:42:03 -07:00
committed by Facebook GitHub Bot
parent e007c8a9de
commit 03e513de41
4 changed files with 20 additions and 6 deletions
@@ -184,7 +184,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
}
@Override
public void onChildStartedNativeGesture(MotionEvent androidEvent) {
public void onChildStartedNativeGesture(MotionEvent ev) {
if (mReactInstanceManager == null
|| !mIsAttachedToInstance
|| mReactInstanceManager.getCurrentReactContext() == null) {
@@ -200,10 +200,15 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
if (uiManager != null) {
EventDispatcher eventDispatcher = uiManager.getEventDispatcher();
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, eventDispatcher);
mJSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher);
}
}
@Override
public void onChildStartedNativeGesture(View childView, MotionEvent ev) {
onChildStartedNativeGesture(ev);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
dispatchJSTouchEvent(ev);
@@ -8,6 +8,7 @@
package com.facebook.react.uimanager;
import android.view.MotionEvent;
import android.view.View;
/** Interface for the root native view of a React native application. */
public interface RootView {
@@ -16,7 +17,10 @@ public interface RootView {
* Called when a child starts a native gesture (e.g. a scroll in a ScrollView). Should be called
* from the child's onTouchIntercepted implementation.
*/
void onChildStartedNativeGesture(MotionEvent androidEvent);
void onChildStartedNativeGesture(View childView, MotionEvent ev);
/** @deprecated */
void onChildStartedNativeGesture(MotionEvent ev);
void handleException(Throwable t);
}
@@ -23,6 +23,6 @@ public class NativeGestureUtil {
* @param event the MotionEvent that caused the gesture to be started
*/
public static void notifyNativeGestureStarted(View view, MotionEvent event) {
RootViewUtil.getRootView(view).onChildStartedNativeGesture(event);
RootViewUtil.getRootView(view).onChildStartedNativeGesture(view, event);
}
}
@@ -528,8 +528,13 @@ public class ReactModalHostView extends ViewGroup
}
@Override
public void onChildStartedNativeGesture(MotionEvent androidEvent) {
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, mEventDispatcher);
public void onChildStartedNativeGesture(MotionEvent ev) {
mJSTouchDispatcher.onChildStartedNativeGesture(ev, mEventDispatcher);
}
@Override
public void onChildStartedNativeGesture(View childView, MotionEvent ev) {
mJSTouchDispatcher.onChildStartedNativeGesture(ev, mEventDispatcher);
}
@Override