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 (#57259)
Summary:
X-link: #57128
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
@@ -3313,6 +3313,11 @@ public abstract class com/facebook/react/uimanager/GuardedFrameCallback : androi
3313
3313
protected abstract fun doFrameGuarded (J)V
3314
3314
}
3315
3315
3316
+
public abstract interface class com/facebook/react/uimanager/HasChildPressedStateDelay {
3317
+
public abstract fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
3318
+
public abstract fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
3319
+
}
3320
+
3316
3321
public abstract interface class com/facebook/react/uimanager/IViewGroupManager : com/facebook/react/uimanager/IViewManagerWithChildren {
3317
3322
public abstract fun addView (Landroid/view/View;Landroid/view/View;I)V
3318
3323
public abstract fun getChildAt (Landroid/view/View;I)Landroid/view/View;
@@ -5156,10 +5161,13 @@ public abstract interface class com/facebook/react/viewmanagers/VirtualViewManag
5156
5161
public abstract fun setRenderState (Landroid/view/View;I)V
5157
5162
}
5158
5163
5159
-
public final class com/facebook/react/views/drawer/ReactDrawerLayout : androidx/drawerlayout/widget/DrawerLayout {
5164
+
public final class com/facebook/react/views/drawer/ReactDrawerLayout : androidx/drawerlayout/widget/DrawerLayout, com/facebook/react/uimanager/HasChildPressedStateDelay {
5160
5165
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
5166
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5161
5167
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
5162
5168
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
5169
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5170
+
public fun shouldDelayChildPressedState ()Z
5163
5171
}
5164
5172
5165
5173
public final class com/facebook/react/views/drawer/ReactDrawerLayoutManager : com/facebook/react/uimanager/ViewGroupManager, com/facebook/react/viewmanagers/AndroidDrawerLayoutManagerInterface {
@@ -5460,7 +5468,7 @@ public final class com/facebook/react/views/scroll/ReactHorizontalScrollContaine
5460
5468
public final class com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager$Companion {
5461
5469
}
5462
5470
5463
-
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 {
5471
+
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 {
5464
5472
public fun <init> (Landroid/content/Context;)V
5465
5473
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
5466
5474
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -5480,6 +5488,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
5480
5488
public fun getFadingEdgeLengthStart ()I
5481
5489
public fun getFlingAnimator ()Landroid/animation/ValueAnimator;
5482
5490
public fun getFlingExtrapolatedDistance (I)I
5491
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5483
5492
public fun getLastScrollDispatchTime ()J
5484
5493
protected fun getLeftFadingEdgeStrength ()F
5485
5494
public fun getOverflow ()Ljava/lang/String;
@@ -5527,6 +5536,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
5527
5536
public fun setEndFillColor (I)V
5528
5537
public fun setFadingEdgeLengthEnd (I)V
5529
5538
public fun setFadingEdgeLengthStart (I)V
5539
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5530
5540
public fun setLastScrollDispatchTime (J)V
5531
5541
public fun setOverflow (Ljava/lang/String;)V
5532
5542
public fun setOverflowInset (IIII)V
@@ -5545,6 +5555,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
5545
5555
public fun setSnapToEnd (Z)V
5546
5556
public fun setSnapToStart (Z)V
5547
5557
public fun setStateWrapper (Lcom/facebook/react/uimanager/StateWrapper;)V
5558
+
public fun shouldDelayChildPressedState ()Z
5548
5559
public fun startFlingAnimator (II)V
5549
5560
public fun updateClippingRect ()V
5550
5561
public fun updateClippingRect (Ljava/util/Set;)V
@@ -5607,7 +5618,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager :
5607
5618
public final class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager$Companion {
5608
5619
}
5609
5620
5610
-
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 {
5621
+
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 {
5611
5622
public fun <init> (Landroid/content/Context;)V
5612
5623
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
5613
5624
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -5625,6 +5636,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
5625
5636
public fun getFadingEdgeLengthStart ()I
5626
5637
public fun getFlingAnimator ()Landroid/animation/ValueAnimator;
5627
5638
public fun getFlingExtrapolatedDistance (I)I
5639
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5628
5640
public fun getLastScrollDispatchTime ()J
5629
5641
protected fun getOverScrollerFromParent ()Landroid/widget/OverScroller;
5630
5642
public fun getOverflow ()Ljava/lang/String;
@@ -5671,6 +5683,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
5671
5683
public fun setEndFillColor (I)V
5672
5684
public fun setFadingEdgeLengthEnd (I)V
5673
5685
public fun setFadingEdgeLengthStart (I)V
5686
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5674
5687
public fun setLastScrollDispatchTime (J)V
5675
5688
public fun setOverflow (Ljava/lang/String;)V
5676
5689
public fun setOverflowInset (IIII)V
@@ -5691,6 +5704,7 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
5691
5704
public fun setSnapToEnd (Z)V
5692
5705
public fun setSnapToStart (Z)V
5693
5706
public fun setStateWrapper (Lcom/facebook/react/uimanager/StateWrapper;)V
5707
+
public fun shouldDelayChildPressedState ()Z
5694
5708
public fun startFlingAnimator (II)V
5695
5709
public fun updateClippingRect ()V
5696
5710
public fun updateClippingRect (Ljava/util/Set;)V
@@ -5959,15 +5973,18 @@ public final class com/facebook/react/views/scroll/VirtualViewContainerState$Com
5959
5973
public final fun create (Landroid/view/ViewGroup;)Lcom/facebook/react/views/scroll/VirtualViewContainerState;
5960
5974
}
5961
5975
5962
-
public class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout {
5976
+
public class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout, com/facebook/react/uimanager/HasChildPressedStateDelay {
5963
5977
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
5964
5978
public fun canChildScrollUp ()Z
5979
+
public fun getHasChildPressedStateDelay ()Ljava/lang/Boolean;
5965
5980
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
5966
5981
public fun onLayout (ZIIII)V
5967
5982
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
5968
5983
public fun requestDisallowInterceptTouchEvent (Z)V
5984
+
public fun setHasChildPressedStateDelay (Ljava/lang/Boolean;)V
5969
5985
public final fun setProgressViewOffset (F)V
5970
5986
public fun setRefreshing (Z)V
5987
+
public fun shouldDelayChildPressedState ()Z
5971
5988
}
5972
5989
5973
5990
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