Skip to content

Commit ce24bcd

Browse files
zeyapfacebook-github-bot
authored andcommitted
Allow setting blockNativeResponder on Pressable (#52819)
Summary: ## 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
1 parent 869a976 commit ce24bcd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/react-native/Libraries/Components/Pressable/Pressable.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ type PressableBaseProps = $ReadOnly<{
116116
*/
117117
onPressOut?: ?(event: GestureResponderEvent) => mixed,
118118

119+
/**
120+
* Whether to prevent any other native components from becoming responder
121+
* while this pressable is responder.
122+
*/
123+
blockNativeResponder?: ?boolean,
124+
119125
/**
120126
* Either view styles or a function that receives a boolean reflecting whether
121127
* the component is currently pressed and returns view styles.
@@ -183,6 +189,7 @@ function Pressable({
183189
'aria-expanded': ariaExpanded,
184190
'aria-label': ariaLabel,
185191
'aria-selected': ariaSelected,
192+
blockNativeResponder,
186193
cancelable,
187194
children,
188195
delayHoverIn,
@@ -294,10 +301,12 @@ function Pressable({
294301
onPressOut(event);
295302
}
296303
},
304+
blockNativeResponder,
297305
}),
298306
[
299307
android_disableSound,
300308
android_rippleConfig,
309+
blockNativeResponder,
301310
cancelable,
302311
delayHoverIn,
303312
delayHoverOut,

packages/react-native/ReactNativeApi.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<56f048751e6094736be604305b9c6f02>>
7+
* @generated SignedSource<<1f77cd57f1bd57ae59c61a1cc6a58d81>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -3759,6 +3759,7 @@ declare type PressableAndroidRippleConfig = {
37593759
declare type PressableBaseProps = {
37603760
readonly android_disableSound?: boolean
37613761
readonly android_ripple?: PressableAndroidRippleConfig
3762+
readonly blockNativeResponder?: boolean
37623763
readonly cancelable?: boolean
37633764
readonly children?:
37643765
| ((state: PressableStateCallbackType) => React.ReactNode)
@@ -6078,7 +6079,7 @@ export {
60786079
PointerEvent, // 3c454015
60796080
Pressable, // 3c6e4eb9
60806081
PressableAndroidRippleConfig, // 42bc9727
6081-
PressableProps, // 4d37b376
6082+
PressableProps, // 00d5ea16
60826083
PressableStateCallbackType, // 9af36561
60836084
ProcessedColorValue, // 33f74304
60846085
ProgressBarAndroid, // 03e66cf5

0 commit comments

Comments
 (0)