diff --git a/packages/react-native-gesture-handler/src/__tests__/mocks.test.tsx b/packages/react-native-gesture-handler/src/__tests__/mocks.test.tsx
index 2cc05f6073..3ab5541eb5 100644
--- a/packages/react-native-gesture-handler/src/__tests__/mocks.test.tsx
+++ b/packages/react-native-gesture-handler/src/__tests__/mocks.test.tsx
@@ -173,3 +173,51 @@ test('Pressable exposes its press handlers to testing-library', () => {
expect(button.props.testOnly_onPressOut).toBe(onPressOut);
expect(button.props.testOnly_onLongPress).toBe(onLongPress);
});
+
+test('Pressable exposes its hover handlers to testing-library', () => {
+ const onHoverIn = jest.fn();
+ const onHoverOut = jest.fn();
+
+ render(
+
+
+ Hover Me
+
+
+ );
+
+ const button = screen.getByTestId('pressable');
+
+ expect(button.props.testOnly_onHoverIn).toBe(onHoverIn);
+ expect(button.props.testOnly_onHoverOut).toBe(onHoverOut);
+});
+
+test('StatefulPressable exposes its press and hover handlers to testing-library', () => {
+ // A relation prop routes `Pressable` to the `StatefulPressable` engine,
+ // which has to forward the same `testOnly_*` props as the default engine.
+ const onPress = jest.fn();
+ const onHoverIn = jest.fn();
+ const onHoverOut = jest.fn();
+
+ render(
+
+
+ Press Me
+
+
+ );
+
+ const button = screen.getByTestId('pressable');
+
+ expect(button.props.testOnly_onPress).toBe(onPress);
+ expect(button.props.testOnly_onHoverIn).toBe(onHoverIn);
+ expect(button.props.testOnly_onHoverOut).toBe(onHoverOut);
+});
diff --git a/packages/react-native-gesture-handler/src/components/GestureButtonsProps.ts b/packages/react-native-gesture-handler/src/components/GestureButtonsProps.ts
index 203ca2751f..3131e0e575 100644
--- a/packages/react-native-gesture-handler/src/components/GestureButtonsProps.ts
+++ b/packages/react-native-gesture-handler/src/components/GestureButtonsProps.ts
@@ -93,6 +93,20 @@ export interface LegacyRawButtonProps
*/
// eslint-disable-next-line @typescript-eslint/ban-types
testOnly_onLongPress?: Function | null | undefined;
+
+ /**
+ * Used for testing-library compatibility, not passed to the native component.
+ * @deprecated test-only props are deprecated and will be removed in the future.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ testOnly_onHoverIn?: Function | null | undefined;
+
+ /**
+ * Used for testing-library compatibility, not passed to the native component.
+ * @deprecated test-only props are deprecated and will be removed in the future.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ testOnly_onHoverOut?: Function | null | undefined;
}
interface ButtonWithRefProps {
innerRef?: React.Ref> | undefined;
diff --git a/packages/react-native-gesture-handler/src/components/GestureHandlerButton.tsx b/packages/react-native-gesture-handler/src/components/GestureHandlerButton.tsx
index 5c17d14cad..90a01f429d 100644
--- a/packages/react-native-gesture-handler/src/components/GestureHandlerButton.tsx
+++ b/packages/react-native-gesture-handler/src/components/GestureHandlerButton.tsx
@@ -264,6 +264,20 @@ export interface ButtonProps extends ViewProps, AccessibilityProps {
*/
// eslint-disable-next-line @typescript-eslint/ban-types
testOnly_onLongPress?: Function | null | undefined;
+
+ /**
+ * Used for testing-library compatibility, not passed to the native component.
+ * @deprecated test-only props are deprecated and will be removed in the future.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ testOnly_onHoverIn?: Function | null | undefined;
+
+ /**
+ * Used for testing-library compatibility, not passed to the native component.
+ * @deprecated test-only props are deprecated and will be removed in the future.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ testOnly_onHoverOut?: Function | null | undefined;
}
export const ButtonComponent =
diff --git a/packages/react-native-gesture-handler/src/components/Pressable/Pressable.tsx b/packages/react-native-gesture-handler/src/components/Pressable/Pressable.tsx
index 25f0d48d9b..4828a481d6 100644
--- a/packages/react-native-gesture-handler/src/components/Pressable/Pressable.tsx
+++ b/packages/react-native-gesture-handler/src/components/Pressable/Pressable.tsx
@@ -399,7 +399,9 @@ const LegacyPressable = (props: LegacyPressableProps) => {
testOnly_onPress={IS_TEST_ENV ? onPress : undefined}
testOnly_onPressIn={IS_TEST_ENV ? onPressIn : undefined}
testOnly_onPressOut={IS_TEST_ENV ? onPressOut : undefined}
- testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}>
+ testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}
+ testOnly_onHoverIn={IS_TEST_ENV ? onHoverIn : undefined}
+ testOnly_onHoverOut={IS_TEST_ENV ? onHoverOut : undefined}>
{childrenProp}
{__DEV__ ? (
diff --git a/packages/react-native-gesture-handler/src/components/Pressable/PressableProps.tsx b/packages/react-native-gesture-handler/src/components/Pressable/PressableProps.tsx
index 4bab919222..5ccd43d514 100644
--- a/packages/react-native-gesture-handler/src/components/Pressable/PressableProps.tsx
+++ b/packages/react-native-gesture-handler/src/components/Pressable/PressableProps.tsx
@@ -58,19 +58,19 @@ export interface PressableProps extends CommonPressableProps {
* A gesture object or an array of gesture objects containing the configuration and callbacks to be
* used with the Pressable's gesture handlers.
*/
- simultaneousWith?: AnyGesture;
+ simultaneousWith?: AnyGesture | AnyGesture[];
/**
* A gesture object or an array of gesture objects containing the configuration and callbacks to be
* used with the Pressable's gesture handlers.
*/
- requireToFail?: AnyGesture;
+ requireToFail?: AnyGesture | AnyGesture[];
/**
* A gesture object or an array of gesture objects containing the configuration and callbacks to be
* used with the Pressable's gesture handlers.
*/
- block?: AnyGesture;
+ block?: AnyGesture | AnyGesture[];
}
interface CommonPressableProps
diff --git a/packages/react-native-gesture-handler/src/v3/components/PressableWithTouchable.tsx b/packages/react-native-gesture-handler/src/v3/components/PressableWithTouchable.tsx
index 03ac35b79f..6f800fcec3 100644
--- a/packages/react-native-gesture-handler/src/v3/components/PressableWithTouchable.tsx
+++ b/packages/react-native-gesture-handler/src/v3/components/PressableWithTouchable.tsx
@@ -321,7 +321,9 @@ const PressableWithTouchable = (props: PressableProps) => {
testOnly_onPress={IS_TEST_ENV ? onPress : undefined}
testOnly_onPressIn={IS_TEST_ENV ? onPressIn : undefined}
testOnly_onPressOut={IS_TEST_ENV ? onPressOut : undefined}
- testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}>
+ testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}
+ testOnly_onHoverIn={IS_TEST_ENV ? onHoverIn : undefined}
+ testOnly_onHoverOut={IS_TEST_ENV ? onHoverOut : undefined}>
{resolvedChildren}
{__DEV__ ? (
diff --git a/packages/react-native-gesture-handler/src/v3/components/StatefulPressable.tsx b/packages/react-native-gesture-handler/src/v3/components/StatefulPressable.tsx
index 2089399751..38fc07b022 100644
--- a/packages/react-native-gesture-handler/src/v3/components/StatefulPressable.tsx
+++ b/packages/react-native-gesture-handler/src/v3/components/StatefulPressable.tsx
@@ -463,7 +463,9 @@ const StatefulPressable = (props: PressableProps) => {
testOnly_onPress={IS_TEST_ENV ? onPress : undefined}
testOnly_onPressIn={IS_TEST_ENV ? onPressIn : undefined}
testOnly_onPressOut={IS_TEST_ENV ? onPressOut : undefined}
- testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}>
+ testOnly_onLongPress={IS_TEST_ENV ? onLongPress : undefined}
+ testOnly_onHoverIn={IS_TEST_ENV ? onHoverIn : undefined}
+ testOnly_onHoverOut={IS_TEST_ENV ? onHoverOut : undefined}>
{childrenProp}
{__DEV__ ? (