From 30e2345b263233a4ebac6a4839885c8bc337bdfd Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Thu, 10 Aug 2023 17:53:58 -0700 Subject: [PATCH] Pressability: Replace `cancelable` Change w/ `blockNativeResponder` Summary: {D47225928} introduced a bug affecting `TextInput` on iOS that prevented native text editing capabilities. This reverts the change to a previous incarnation of the diff where javache created a new `blockNativeResponder` option instead of piggybacking off the existing `cancelable` option. Changelog: [iOS][Changed] - Restored `cancelable` option in `Pressability` configuration to not block native responder, and instead introduced a new optional `blockNativeResponder` boolean option to accomplish the same thing. Reviewed By: mdvacca Differential Revision: D48246530 fbshipit-source-id: 8a406d462cce0e5e5a108607e1ac1d3203ea229c --- .../react-native/Libraries/Pressability/Pressability.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Pressability/Pressability.js b/packages/react-native/Libraries/Pressability/Pressability.js index f577c621558..24f664c27da 100644 --- a/packages/react-native/Libraries/Pressability/Pressability.js +++ b/packages/react-native/Libraries/Pressability/Pressability.js @@ -131,6 +131,12 @@ export type PressabilityConfig = $ReadOnly<{| */ onPressOut?: ?(event: PressEvent) => mixed, + /** + * Whether to prevent any other native components from becoming responder + * while this pressable is responder. + */ + blockNativeResponder?: ?boolean, + /** * Returns whether a long press gesture should cancel the press gesture. * Defaults to true. @@ -495,7 +501,7 @@ export default class Pressability { this._handleLongPress(event); }, delayLongPress + delayPressIn); - return this._config.cancelable === false; + return this._config.blockNativeResponder === true; }, onResponderMove: (event: PressEvent): void => {