diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index bbad17e405b..4a63b8cda1e 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -6741,15 +6741,20 @@ public final class com/facebook/react/views/scroll/ScrollEvent$Companion { public final class com/facebook/react/views/scroll/ScrollEventType : java/lang/Enum { public static final field BEGIN_DRAG Lcom/facebook/react/views/scroll/ScrollEventType; + public static final field Companion Lcom/facebook/react/views/scroll/ScrollEventType$Companion; public static final field END_DRAG Lcom/facebook/react/views/scroll/ScrollEventType; public static final field MOMENTUM_BEGIN Lcom/facebook/react/views/scroll/ScrollEventType; public static final field MOMENTUM_END Lcom/facebook/react/views/scroll/ScrollEventType; public static final field SCROLL Lcom/facebook/react/views/scroll/ScrollEventType; - public static fun getJSEventName (Lcom/facebook/react/views/scroll/ScrollEventType;)Ljava/lang/String; + public static final fun getJSEventName (Lcom/facebook/react/views/scroll/ScrollEventType;)Ljava/lang/String; public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/views/scroll/ScrollEventType; public static fun values ()[Lcom/facebook/react/views/scroll/ScrollEventType; } +public final class com/facebook/react/views/scroll/ScrollEventType$Companion { + public final fun getJSEventName (Lcom/facebook/react/views/scroll/ScrollEventType;)Ljava/lang/String; +} + public class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout { public fun (Lcom/facebook/react/bridge/ReactContext;)V public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java deleted file mode 100644 index b58173850da..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.scroll; - -import com.facebook.infer.annotation.Nullsafe; - -/** Scroll event types that JS module RCTEventEmitter can understand */ -@Nullsafe(Nullsafe.Mode.LOCAL) -public enum ScrollEventType { - BEGIN_DRAG, - END_DRAG, - SCROLL, - MOMENTUM_BEGIN, - MOMENTUM_END; - - public static String getJSEventName(ScrollEventType type) { - switch (type) { - case BEGIN_DRAG: - return "topScrollBeginDrag"; - case END_DRAG: - return "topScrollEndDrag"; - case SCROLL: - return "topScroll"; - case MOMENTUM_BEGIN: - return "topMomentumScrollBegin"; - case MOMENTUM_END: - return "topMomentumScrollEnd"; - default: - throw new IllegalArgumentException("Unsupported ScrollEventType: " + type); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.kt new file mode 100644 index 00000000000..94d8d82eba0 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.views.scroll + +/** Scroll event types that JS module RCTEventEmitter can understand */ +public enum class ScrollEventType { + BEGIN_DRAG, + END_DRAG, + SCROLL, + MOMENTUM_BEGIN, + MOMENTUM_END; + + public companion object { + @JvmStatic + public fun getJSEventName(type: ScrollEventType): String = + when (type) { + BEGIN_DRAG -> "topScrollBeginDrag" + END_DRAG -> "topScrollEndDrag" + SCROLL -> "topScroll" + MOMENTUM_BEGIN -> "topMomentumScrollBegin" + MOMENTUM_END -> "topMomentumScrollEnd" + } + } +}