adding onPressMove to Pressable (#50139)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50139

adding this event to Pressable because it is going to be consumed after to track if pressable location is moved

Changelog:
[General] [Added] - Expose `onPressMove` as base prop for `Pressable`

Reviewed By: thurn

Differential Revision: D71429258

fbshipit-source-id: 79acaa735764a47a21d89042d3e4b9c114c72950
This commit is contained in:
Regina Tuk authored and Facebook GitHub Bot committed 2025-03-19 16:53:20 -07:00
1 parent c2864c160d
commit 6df938c72e
2 files changed
+13 -1

No files matched your search

@@ -105,6 +105,10 @@ type PressableBaseProps = $ReadOnly<{
* Called when a touch is engaged before `onPress`.
*/
onPressIn?: ?(event: GestureResponderEvent) => mixed,
/**
* Called when the press location moves.
*/
onPressMove?: ?(event: GestureResponderEvent) => mixed,
/**
* Called when a touch is released before `onPress`.
@@ -185,6 +189,7 @@ function Pressable(
onLongPress,
onPress,
onPressIn,
onPressMove,
onPressOut,
pressRetentionOffset,
style,
@@ -263,7 +268,12 @@ function Pressable(
onPressIn(event);
}
},
onPressMove: android_rippleConfig?.onPressMove,
onPressMove(event: GestureResponderEvent): void {
android_rippleConfig?.onPressMove(event);
if (onPressMove != null) {
onPressMove(event);
}
},
onPressOut(event: GestureResponderEvent): void {
if (android_rippleConfig != null) {
android_rippleConfig.onPressOut(event);
@@ -288,6 +298,7 @@ function Pressable(
onLongPress,
onPress,
onPressIn,
onPressMove,
onPressOut,
pressRetentionOffset,
setPressed,
@@ -1719,6 +1719,7 @@ type PressableBaseProps = $ReadOnly<{
onLongPress?: ?(event: GestureResponderEvent) => mixed,
onPress?: ?(event: GestureResponderEvent) => mixed,
onPressIn?: ?(event: GestureResponderEvent) => mixed,
onPressMove?: ?(event: GestureResponderEvent) => mixed,
onPressOut?: ?(event: GestureResponderEvent) => mixed,
style?:
| ViewStyleProp