Skip to content

Commit 286b374

Browse files
authored
Extract HoverEffect to a standalone module (#4379)
## Description `HoverEffect` moves from `handlers/gestures/hoverGesture.ts` to a standalone `src/HoverEffect.ts`, following the naming pattern of the other root-level shared leaves (`State.ts`, `TouchEventType.ts`). The v3 hover types imported it from the legacy gesture module, pulling the whole v2 class hierarchy into the v3 import graph for the sake of one enum. ## Test plan - `yarn ts-check` clean; `yarn test` green (103 + 3 new); `yarn lint:js` 0 errors - Verified on iOS simulator (expo-example, fresh bundle): the v3 hover example — which imports `HoverEffect` from the barrel at module scope and passes `HoverEffect.LIFT` as a config value — mounts and renders cleanly
1 parent ae8e704 commit 286b374

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export enum HoverEffect {
2+
NONE = 0,
3+
LIFT = 1,
4+
HIGHLIGHT = 2,
5+
}

‎packages/react-native-gesture-handler/src/handlers/gestures/hoverGesture.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { HoverEffect } from '../../HoverEffect';
12
import type { GestureUpdateEvent } from '../gestureHandlerCommon';
23
import type { HoverGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
34
import type { BaseGestureConfig } from './gesture';
@@ -8,12 +9,6 @@ export type HoverGestureChangeEventPayload = {
89
changeY: number;
910
};
1011

11-
export enum HoverEffect {
12-
NONE = 0,
13-
LIFT = 1,
14-
HIGHLIGHT = 2,
15-
}
16-
1712
export interface HoverGestureConfig {
1813
hoverEffect?: HoverEffect;
1914
}

‎packages/react-native-gesture-handler/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ export type {
127127
export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';
128128
export type { GestureStateManagerType as LegacyGestureStateManager } from './handlers/gestures/gestureStateManager';
129129
export type { HoverGestureType as LegacyHoverGesture } from './handlers/gestures/hoverGesture';
130-
export { HoverEffect } from './handlers/gestures/hoverGesture';
131130
export type { LongPressGestureType as LegacyLongPressGesture } from './handlers/gestures/longPressGesture';
132131
export type { ManualGestureType as LegacyManualGesture } from './handlers/gestures/manualGesture';
133132
export type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';
@@ -148,6 +147,7 @@ export type { RotationGestureHandlerProps } from './handlers/RotationGestureHand
148147
export { RotationGestureHandler } from './handlers/RotationGestureHandler';
149148
export type { TapGestureHandlerProps } from './handlers/TapGestureHandler';
150149
export { TapGestureHandler } from './handlers/TapGestureHandler';
150+
export { HoverEffect } from './HoverEffect';
151151
export { PointerType } from './PointerType';
152152
export { State } from './State';
153153
export * from './v3';

‎packages/react-native-gesture-handler/src/v3/hooks/gestures/hover/HoverTypes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { StylusData } from '../../../../handlers/gestureHandlerCommon';
2-
import type { HoverEffect } from '../../../../handlers/gestures/hoverGesture';
2+
import type { HoverEffect } from '../../../../HoverEffect';
33
import type {
44
BaseGestureConfig,
55
ExcludeInternalConfigProps,

0 commit comments

Comments
 (0)