mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Convert ReactHorizontalScrollView to Kotlin (#57045)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/57045 Convert `ReactHorizontalScrollView.java` to `ReactHorizontalScrollView.kt` using idiomatic Kotlin while preserving the public API surface. Key changes: - `ReactHorizontalScrollView.java` replaced by `ReactHorizontalScrollView.kt` - `ReactHorizontalScrollViewManager.kt` updated to use Kotlin property access syntax for `scrollEnabled`, `stateWrapper`, and `fadingEdgeLengthStart/End` - Static helper methods (`findDeepestScrollViewForMotionEvent`) moved into the companion object - Public API surface preserved: only additive `synthetic` constructor from `JvmOverloads` Changelog: [Android][Changed] - Convert `ReactHorizontalScrollView` from Java to Kotlin Reviewed By: Abbondanzo Differential Revision: D107236883 fbshipit-source-id: 37fb0f646193c2fc88008196f0db6e7307332109
This commit is contained in:
1 parent
9d65e6c497
commit
5c680995bd
4 files changed
+1632
-1852
No files matched your search
@@ -5475,6 +5475,7 @@ public final class com/facebook/react/views/scroll/ReactHorizontalScrollContaine
|
||||
public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android/widget/HorizontalScrollView, android/view/View$OnLayoutChangeListener, android/view/ViewGroup$OnHierarchyChangeListener, com/facebook/react/uimanager/ReactClippingViewGroup, com/facebook/react/uimanager/ReactOverflowViewWithInset, com/facebook/react/views/scroll/ReactAccessibleScrollView, com/facebook/react/views/scroll/ReactScrollViewHelper$HasFlingAnimator, com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollEventThrottle, com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollState, com/facebook/react/views/scroll/ReactScrollViewHelper$HasSmoothScroll, com/facebook/react/views/scroll/ReactScrollViewHelper$HasStateWrapper, com/facebook/react/views/scroll/VirtualViewContainer {
|
||||
public fun <init> (Landroid/content/Context;)V
|
||||
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
|
||||
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun abortAnimation ()V
|
||||
public fun addFocusables (Ljava/util/ArrayList;II)V
|
||||
public fun arrowScroll (I)Z
|
||||
|
||||
-1846
File diff suppressed because it is too large.
Load diff
+1625
File diff suppressed because it is too large.
Load diff
+6
-6
@@ -84,7 +84,7 @@ constructor(private val fpsListener: FpsListener? = null) :
|
||||
props: ReactStylesDiffMap,
|
||||
stateWrapper: StateWrapper,
|
||||
): Any? {
|
||||
view.setStateWrapper(stateWrapper)
|
||||
view.stateWrapper = stateWrapper
|
||||
if (
|
||||
ReactNativeFeatureFlags.enableViewCulling() ||
|
||||
ReactNativeFeatureFlags.useTraitHiddenOnAndroid()
|
||||
@@ -96,7 +96,7 @@ constructor(private val fpsListener: FpsListener? = null) :
|
||||
|
||||
@ReactProp(name = "scrollEnabled", defaultBoolean = true)
|
||||
public fun setScrollEnabled(view: ReactHorizontalScrollView, value: Boolean) {
|
||||
view.setScrollEnabled(value)
|
||||
view.scrollEnabled = value
|
||||
}
|
||||
|
||||
@ReactProp(name = "showsHorizontalScrollIndicator", defaultBoolean = true)
|
||||
@@ -351,8 +351,8 @@ constructor(private val fpsListener: FpsListener? = null) :
|
||||
public fun setFadingEdgeLength(view: ReactHorizontalScrollView, value: Dynamic) {
|
||||
when (value.type) {
|
||||
ReadableType.Number -> {
|
||||
view.setFadingEdgeLengthStart(value.asInt())
|
||||
view.setFadingEdgeLengthEnd(value.asInt())
|
||||
view.fadingEdgeLengthStart = value.asInt()
|
||||
view.fadingEdgeLengthEnd = value.asInt()
|
||||
}
|
||||
ReadableType.Map -> {
|
||||
value.asMap()?.let { map ->
|
||||
@@ -364,8 +364,8 @@ constructor(private val fpsListener: FpsListener? = null) :
|
||||
if (map.hasKey("end") && map.getInt("end") > 0) {
|
||||
end = map.getInt("end")
|
||||
}
|
||||
view.setFadingEdgeLengthStart(start)
|
||||
view.setFadingEdgeLengthEnd(end)
|
||||
view.fadingEdgeLengthStart = start
|
||||
view.fadingEdgeLengthEnd = end
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
|
||||
Reference in new issue
Block a user