You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow to disable shouldDelayChildPressedState on scrollable Android containers
Summary:
Changelog: [Android][Added] Added an entry point that allows changing whether the scrollable React Native containers should delay pressed state in children views
Scrollable Android containers should return `true` (the default implementation) from [`shouldDelayChildPressedState`](https://developer.android.com/reference/android/view/ViewGroup#shouldDelayChildPressedState%28%29) in order to delay pressed state feedback in children. This way the feedback isn't triggered at all during quick scrolls.
React Native touch system doesn't rely on this so it's not affected by that behavior, but native components are which can produce a divergent experience. This diff adds a property to all scrollable components of React Native which allows external consumers to control this behavor on a per-view basis. The API is analoguous to [`delaysContentTouches`](https://developer.apple.com/documentation/uikit/uiscrollview/delayscontenttouches?language=objc) on iOS.
Differential Revision: D108003375
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/api/ReactAndroid.api
+21-4Lines changed: 21 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3303,6 +3303,11 @@ public abstract class com/facebook/react/uimanager/GuardedFrameCallback : androi
3303
3303
protected abstract fun doFrameGuarded (J)V
3304
3304
}
3305
3305
3306
+
public abstract interface class com/facebook/react/uimanager/HasChildPressedStateDelay {
3307
+
public abstract fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
3308
+
public abstract fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
3309
+
}
3310
+
3306
3311
public abstract interface class com/facebook/react/uimanager/IViewGroupManager : com/facebook/react/uimanager/IViewManagerWithChildren {
3307
3312
public abstract fun addView (Landroid/view/View;Landroid/view/View;I)V
3308
3313
public abstract fun getChildAt (Landroid/view/View;I)Landroid/view/View;
@@ -5146,10 +5151,13 @@ public abstract interface class com/facebook/react/viewmanagers/VirtualViewManag
5146
5151
public abstract fun setRenderState (Landroid/view/View;I)V
5147
5152
}
5148
5153
5149
-
public final class com/facebook/react/views/drawer/ReactDrawerLayout : androidx/drawerlayout/widget/DrawerLayout {
5154
+
public final class com/facebook/react/views/drawer/ReactDrawerLayout : androidx/drawerlayout/widget/DrawerLayout, com/facebook/react/uimanager/HasChildPressedStateDelay {
5150
5155
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
5156
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5151
5157
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
5152
5158
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
5159
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5160
+
public fun shouldDelayChildPressedState ()Z
5153
5161
}
5154
5162
5155
5163
public final class com/facebook/react/views/drawer/ReactDrawerLayoutManager : com/facebook/react/uimanager/ViewGroupManager, com/facebook/react/viewmanagers/AndroidDrawerLayoutManagerInterface {
@@ -5450,7 +5458,7 @@ public final class com/facebook/react/views/scroll/ReactHorizontalScrollContaine
5450
5458
public final class com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager$Companion {
5451
5459
}
5452
5460
5453
-
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 {
5461
+
public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android/widget/HorizontalScrollView, android/view/View$OnLayoutChangeListener, android/view/ViewGroup$OnHierarchyChangeListener, com/facebook/react/uimanager/HasChildPressedStateDelay, 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 {
5454
5462
public fun <init> (Landroid/content/Context;)V
5455
5463
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
5456
5464
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -5470,6 +5478,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
5470
5478
public fun getFadingEdgeLengthStart ()I
5471
5479
public fun getFlingAnimator ()Landroid/animation/ValueAnimator;
5472
5480
public fun getFlingExtrapolatedDistance (I)I
5481
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5473
5482
public fun getLastScrollDispatchTime ()J
5474
5483
protected fun getLeftFadingEdgeStrength ()F
5475
5484
public fun getOverflow ()Ljava/lang/String;
@@ -5517,6 +5526,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
5517
5526
public fun setEndFillColor (I)V
5518
5527
public fun setFadingEdgeLengthEnd (I)V
5519
5528
public fun setFadingEdgeLengthStart (I)V
5529
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5520
5530
public fun setLastScrollDispatchTime (J)V
5521
5531
public fun setOverflow (Ljava/lang/String;)V
5522
5532
public fun setOverflowInset (IIII)V
@@ -5535,6 +5545,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
5535
5545
public fun setSnapToEnd (Z)V
5536
5546
public fun setSnapToStart (Z)V
5537
5547
public fun setStateWrapper (Lcom/facebook/react/uimanager/StateWrapper;)V
5548
+
public fun shouldDelayChildPressedState ()Z
5538
5549
public fun startFlingAnimator (II)V
5539
5550
public fun updateClippingRect ()V
5540
5551
public fun updateClippingRect (Ljava/util/Set;)V
@@ -5597,7 +5608,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager :
5597
5608
public final class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager$Companion {
5598
5609
}
5599
5610
5600
-
public class com/facebook/react/views/scroll/ReactScrollView : android/widget/ScrollView, 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 {
5611
+
public class com/facebook/react/views/scroll/ReactScrollView : android/widget/ScrollView, android/view/View$OnLayoutChangeListener, android/view/ViewGroup$OnHierarchyChangeListener, com/facebook/react/uimanager/HasChildPressedStateDelay, 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 {
5601
5612
public fun <init> (Landroid/content/Context;)V
5602
5613
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
5603
5614
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -5615,6 +5626,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
5615
5626
public fun getFadingEdgeLengthStart ()I
5616
5627
public fun getFlingAnimator ()Landroid/animation/ValueAnimator;
5617
5628
public fun getFlingExtrapolatedDistance (I)I
5629
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5618
5630
public fun getLastScrollDispatchTime ()J
5619
5631
protected fun getOverScrollerFromParent ()Landroid/widget/OverScroller;
5620
5632
public fun getOverflow ()Ljava/lang/String;
@@ -5661,6 +5673,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
5661
5673
public fun setEndFillColor (I)V
5662
5674
public fun setFadingEdgeLengthEnd (I)V
5663
5675
public fun setFadingEdgeLengthStart (I)V
5676
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5664
5677
public fun setLastScrollDispatchTime (J)V
5665
5678
public fun setOverflow (Ljava/lang/String;)V
5666
5679
public fun setOverflowInset (IIII)V
@@ -5681,6 +5694,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
5681
5694
public fun setSnapToEnd (Z)V
5682
5695
public fun setSnapToStart (Z)V
5683
5696
public fun setStateWrapper (Lcom/facebook/react/uimanager/StateWrapper;)V
5697
+
public fun shouldDelayChildPressedState ()Z
5684
5698
public fun startFlingAnimator (II)V
5685
5699
public fun updateClippingRect ()V
5686
5700
public fun updateClippingRect (Ljava/util/Set;)V
@@ -5949,15 +5963,18 @@ public final class com/facebook/react/views/scroll/VirtualViewContainerState$Com
5949
5963
public final fun create (Landroid/view/ViewGroup;)Lcom/facebook/react/views/scroll/VirtualViewContainerState;
5950
5964
}
5951
5965
5952
-
public class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout {
5966
+
public class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout, com/facebook/react/uimanager/HasChildPressedStateDelay {
5953
5967
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
5954
5968
public fun canChildScrollUp ()Z
5969
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5955
5970
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
5956
5971
public fun onLayout (ZIIII)V
5957
5972
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
5958
5973
public fun requestDisallowInterceptTouchEvent (Z)V
5974
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5959
5975
public final fun setProgressViewOffset (F)V
5960
5976
public fun setRefreshing (Z)V
5977
+
public fun shouldDelayChildPressedState ()Z
5961
5978
}
5962
5979
5963
5980
public final class com/facebook/react/views/text/DefaultStyleValuesUtil {
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.kt
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.kt
0 commit comments