Skip to content

Commit 03e513d

Browse files
javachefacebook-github-bot
authored andcommitted
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
1 parent e007c8a commit 03e513d

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
184184
}
185185

186186
@Override
187-
public void onChildStartedNativeGesture(MotionEvent androidEvent) {
187+
public void onChildStartedNativeGesture(MotionEvent ev) {
188188
if (mReactInstanceManager == null
189189
|| !mIsAttachedToInstance
190190
|| mReactInstanceManager.getCurrentReactContext() == null) {
@@ -200,10 +200,15 @@ public void onChildStartedNativeGesture(MotionEvent androidEvent) {
200200

201201
if (uiManager != null) {
202202
EventDispatcher eventDispatcher = uiManager.getEventDispatcher();
203-
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, eventDispatcher);
203+
mJSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher);
204204
}
205205
}
206206

207+
@Override
208+
public void onChildStartedNativeGesture(View childView, MotionEvent ev) {
209+
onChildStartedNativeGesture(ev);
210+
}
211+
207212
@Override
208213
public boolean onInterceptTouchEvent(MotionEvent ev) {
209214
dispatchJSTouchEvent(ev);

ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package com.facebook.react.uimanager;
99

1010
import android.view.MotionEvent;
11+
import android.view.View;
1112

1213
/** Interface for the root native view of a React native application. */
1314
public interface RootView {
@@ -16,7 +17,10 @@ public interface RootView {
1617
* Called when a child starts a native gesture (e.g. a scroll in a ScrollView). Should be called
1718
* from the child's onTouchIntercepted implementation.
1819
*/
19-
void onChildStartedNativeGesture(MotionEvent androidEvent);
20+
void onChildStartedNativeGesture(View childView, MotionEvent ev);
21+
22+
/** @deprecated */
23+
void onChildStartedNativeGesture(MotionEvent ev);
2024

2125
void handleException(Throwable t);
2226
}

ReactAndroid/src/main/java/com/facebook/react/uimanager/events/NativeGestureUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public class NativeGestureUtil {
2323
* @param event the MotionEvent that caused the gesture to be started
2424
*/
2525
public static void notifyNativeGestureStarted(View view, MotionEvent event) {
26-
RootViewUtil.getRootView(view).onChildStartedNativeGesture(event);
26+
RootViewUtil.getRootView(view).onChildStartedNativeGesture(view, event);
2727
}
2828
}

ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,13 @@ public boolean onTouchEvent(MotionEvent event) {
528528
}
529529

530530
@Override
531-
public void onChildStartedNativeGesture(MotionEvent androidEvent) {
532-
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, mEventDispatcher);
531+
public void onChildStartedNativeGesture(MotionEvent ev) {
532+
mJSTouchDispatcher.onChildStartedNativeGesture(ev, mEventDispatcher);
533+
}
534+
535+
@Override
536+
public void onChildStartedNativeGesture(View childView, MotionEvent ev) {
537+
mJSTouchDispatcher.onChildStartedNativeGesture(ev, mEventDispatcher);
533538
}
534539

535540
@Override

0 commit comments

Comments
 (0)