Skip to content

Commit 21c9491

Browse files
fabriziocuccifacebook-github-bot
authored andcommitted
Migrate package com.facebook.react.uimanager.RootView to Kotlin (#47701)
Summary: Pull Request resolved: #47701 As per title. Changelog: [Android][Breaking] Convert RootView to Kotlin Reviewed By: cortinico Differential Revision: D66159881 fbshipit-source-id: 082881a03946088293dde3c085e1d1882bac96be
1 parent 9df20d4 commit 21c9491

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.kt

+11-12
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
package com.facebook.react.uimanager;
8+
package com.facebook.react.uimanager
99

10-
import android.view.MotionEvent;
11-
import android.view.View;
10+
import android.view.MotionEvent
11+
import android.view.View
1212

1313
/** Interface for the root native view of a React native application. */
1414
public interface RootView {
@@ -17,21 +17,20 @@ public interface RootView {
1717
* Called when a child starts a native gesture (e.g. a scroll in a ScrollView). Should be called
1818
* from the child's onTouchIntercepted implementation.
1919
*/
20-
void onChildStartedNativeGesture(View childView, MotionEvent ev);
20+
public fun onChildStartedNativeGesture(childView: View?, ev: MotionEvent)
2121

22-
/**
23-
* @deprecated
24-
*/
25-
@Deprecated
26-
default void onChildStartedNativeGesture(MotionEvent ev) {
27-
onChildStartedNativeGesture(null, ev);
22+
@Deprecated(
23+
message = "Use onChildStartedNativeGesture with a childView parameter.",
24+
replaceWith = ReplaceWith("onChildStartedNativeGesture"))
25+
public fun onChildStartedNativeGesture(ev: MotionEvent) {
26+
onChildStartedNativeGesture(null, ev)
2827
}
2928

3029
/**
3130
* Called when a child ends a native gesture. Should be called from the child's onTouchIntercepted
3231
* implementation.
3332
*/
34-
void onChildEndedNativeGesture(View childView, MotionEvent ev);
33+
public fun onChildEndedNativeGesture(childView: View, ev: MotionEvent)
3534

36-
void handleException(Throwable t);
35+
public fun handleException(t: Throwable)
3736
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
495495
return super.onHoverEvent(event)
496496
}
497497

498-
override fun onChildStartedNativeGesture(childView: View, ev: MotionEvent) {
498+
override fun onChildStartedNativeGesture(childView: View?, ev: MotionEvent) {
499499
eventDispatcher?.let { eventDispatcher ->
500500
jSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher)
501501
jSPointerDispatcher?.onChildStartedNativeGesture(childView, ev, eventDispatcher)

0 commit comments

Comments
 (0)