Skip to content

Commit 67ea1f1

Browse files
bigcupcoffeekelset
authored andcommitted
Fix incorrect touchable hitSlop and pressRetentionOffset type (#36065)
Summary: Incorrect TS type disallows use of `hitSlop={number}`. Fixed by using Pressable's hitSlop type. NOTE: I did not bother to change Flow types in the `.js` file, please add a commit doing that if required. ## Changelog [GENERAL] [FIXED] - Fix touchable hitSlop type Pull Request resolved: #36065 Test Plan: None needed Reviewed By: christophpurrer Differential Revision: D43117689 Pulled By: javache fbshipit-source-id: 96e5ae650f47382c8d7fa1ddf63c76461c65dcc7
1 parent c92e98a commit 67ea1f1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export interface TouchableWithoutFeedbackProps
6969
* the Z-index of sibling views always takes precedence if a touch hits
7070
* two overlapping views.
7171
*/
72-
hitSlop?: Insets | undefined;
72+
hitSlop?: null | Insets | number | undefined;
7373

7474
/**
7575
* Used to reference react managed views from native code.
@@ -121,7 +121,7 @@ export interface TouchableWithoutFeedbackProps
121121
* while the scroll view is disabled. Ensure you pass in a constant
122122
* to reduce memory allocations.
123123
*/
124-
pressRetentionOffset?: Insets | undefined;
124+
pressRetentionOffset?: null | Insets | number | undefined;
125125

126126
/**
127127
* Used to locate this view in end-to-end tests.

Libraries/Components/Touchable/TouchableWithoutFeedback.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
AccessibilityState,
1616
AccessibilityValue,
1717
} from '../../Components/View/ViewAccessibility';
18-
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
18+
import type {EdgeInsetsOrSizeProp} from '../../StyleSheet/EdgeInsetsPropType';
1919
import type {
2020
BlurEvent,
2121
FocusEvent,
@@ -67,7 +67,7 @@ type Props = $ReadOnly<{|
6767
delayPressOut?: ?number,
6868
disabled?: ?boolean,
6969
focusable?: ?boolean,
70-
hitSlop?: ?EdgeInsetsProp,
70+
hitSlop?: ?EdgeInsetsOrSizeProp,
7171
id?: string,
7272
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
7373
nativeID?: ?string,
@@ -79,7 +79,7 @@ type Props = $ReadOnly<{|
7979
onPress?: ?(event: PressEvent) => mixed,
8080
onPressIn?: ?(event: PressEvent) => mixed,
8181
onPressOut?: ?(event: PressEvent) => mixed,
82-
pressRetentionOffset?: ?EdgeInsetsProp,
82+
pressRetentionOffset?: ?EdgeInsetsOrSizeProp,
8383
rejectResponderTermination?: ?boolean,
8484
testID?: ?string,
8585
touchSoundDisabled?: ?boolean,

0 commit comments

Comments
 (0)