Skip to content

Commit c7ff543

Browse files
committed
readded test props
1 parent c5475ab commit c7ff543

File tree

1 file changed

+7
-2
lines changed
  • packages/react-native-gesture-handler/src/v3/components

1 file changed

+7
-2
lines changed

packages/react-native-gesture-handler/src/v3/components/Pressable.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ import { GestureDetector } from '../detectors';
3939
import { PureNativeButton } from './GestureButtons';
4040

4141
import { PressabilityDebugView } from '../../handlers/PressabilityDebugView';
42-
import { INT32_MAX } from '../../utils';
42+
import { INT32_MAX, isTestEnv } from '../../utils';
4343

4444
const DEFAULT_LONG_PRESS_DURATION = 500;
45+
const IS_TEST_ENV = isTestEnv();
4546

4647
const Pressable = (props: PressableProps) => {
4748
const {
@@ -370,7 +371,11 @@ const Pressable = (props: PressableProps) => {
370371
touchSoundDisabled={android_disableSound ?? undefined}
371372
rippleColor={rippleColor}
372373
rippleRadius={android_ripple?.radius ?? undefined}
373-
style={[pointerStyle, styleProp, { minWidth: 44, minHeight: 44 }]}>
374+
style={[pointerStyle, styleProp, { minWidth: 44, minHeight: 44 }]}
375+
testOnly_onPress={IS_TEST_ENV ? onPress : undefined}
376+
testOnly_onPressIn={IS_TEST_ENV ? onPressIn : undefined}
377+
testOnly_onPressOut={IS_TEST_ENV ? onPressOut : undefined}
378+
testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}>
374379
{childrenProp}
375380
{__DEV__ ? (
376381
<PressabilityDebugView color="red" hitSlop={normalizedHitSlop} />

0 commit comments

Comments
 (0)