Allow setting blockNativeResponder on Pressable (#52819)

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

## Changelog:

[General] [Added] - Allow setting blockNativeResponder on Pressable

To expose the same prop on Pressability https://github.com/facebook/react-native/blob/b2d9f5f28045fd89bba2dca41274c7cd7abe2ecc/packages/react-native/Libraries/Pressability/Pressability.js#L137

Reviewed By: christophpurrer

Differential Revision: D78896178

fbshipit-source-id: 36637842ac15c54de325975d416efce1448e8ab7
This commit is contained in:
Zeya Peng
2025-07-28 08:34:04 -07:00
committed by Facebook GitHub Bot
parent 209e124340
commit 6e4d23ded2
2 changed files with 12 additions and 2 deletions
@@ -116,6 +116,12 @@ type PressableBaseProps = $ReadOnly<{
*/
onPressOut?: ?(event: GestureResponderEvent) => mixed,
/**
* Whether to prevent any other native components from becoming responder
* while this pressable is responder.
*/
blockNativeResponder?: ?boolean,
/**
* Either view styles or a function that receives a boolean reflecting whether
* the component is currently pressed and returns view styles.
@@ -183,6 +189,7 @@ function Pressable({
'aria-expanded': ariaExpanded,
'aria-label': ariaLabel,
'aria-selected': ariaSelected,
blockNativeResponder,
cancelable,
children,
delayHoverIn,
@@ -294,10 +301,12 @@ function Pressable({
onPressOut(event);
}
},
blockNativeResponder,
}),
[
android_disableSound,
android_rippleConfig,
blockNativeResponder,
cancelable,
delayHoverIn,
delayHoverOut,
+3 -2
View File
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<56f048751e6094736be604305b9c6f02>>
* @generated SignedSource<<1f77cd57f1bd57ae59c61a1cc6a58d81>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
@@ -3759,6 +3759,7 @@ declare type PressableAndroidRippleConfig = {
declare type PressableBaseProps = {
readonly android_disableSound?: boolean
readonly android_ripple?: PressableAndroidRippleConfig
readonly blockNativeResponder?: boolean
readonly cancelable?: boolean
readonly children?:
| ((state: PressableStateCallbackType) => React.ReactNode)
@@ -6078,7 +6079,7 @@ export {
PointerEvent, // 3c454015
Pressable, // 3c6e4eb9
PressableAndroidRippleConfig, // 42bc9727
PressableProps, // 4d37b376
PressableProps, // 00d5ea16
PressableStateCallbackType, // 9af36561
ProcessedColorValue, // 33f74304
ProgressBarAndroid, // 03e66cf5