Skip to content

Extract HoverEffect to a standalone module - #4379

Merged
m-bert merged 1 commit into
mainfrom
@mbert/extract-hover-effect
Aug 5, 2026
Merged

Extract HoverEffect to a standalone module#4379
m-bert merged 1 commit into
mainfrom
@mbert/extract-hover-effect

Conversation

@m-bert

@m-bert m-bert commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

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

Copilot AI review requested due to automatic review settings August 4, 2026 13:16
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a shared HoverEffect export with NONE, LIFT, and HIGHLIGHT options.
    • Hover gesture configuration now uses this common effect type across the package.

Walkthrough

The HoverEffect enum moves from hoverGesture.ts into a new dedicated module, HoverEffect.ts. References in index.ts, hoverGesture.ts, and HoverTypes.ts update their import or export source to point to this new module.

Changes

HoverEffect module extraction

Layer / File(s) Summary
New shared HoverEffect module
packages/react-native-gesture-handler/src/HoverEffect.ts
Adds the exported HoverEffect enum with NONE, LIFT, and HIGHLIGHT values.
Update imports and exports to use shared module
packages/react-native-gesture-handler/src/handlers/gestures/hoverGesture.ts, packages/react-native-gesture-handler/src/index.ts, packages/react-native-gesture-handler/src/v3/hooks/gestures/hover/HoverTypes.ts
Removes the local HoverEffect enum from hoverGesture.ts and imports it from the new module. Updates the export source in index.ts and the import source in HoverTypes.ts to reference ./HoverEffect.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: extracting the HoverEffect enum from the hoverGesture module into a standalone HoverEffect.ts module.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extracts the HoverEffect enum from the legacy hover gesture module into a standalone src/HoverEffect.ts and updates imports/exports so v3 hover typings no longer depend on the legacy hover gesture module for that shared type.

Changes:

  • Added a new root-level HoverEffect module exporting the enum with stable numeric values (0/1/2).
  • Updated v3 hover types to import HoverEffect from the new standalone module instead of the legacy hover gesture module.
  • Updated the package barrel export (src/index.ts) to re-export HoverEffect from the new module.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/react-native-gesture-handler/src/v3/hooks/gestures/hover/HoverTypes.ts Updates v3 hover type dependency to import HoverEffect from the new standalone module.
packages/react-native-gesture-handler/src/index.ts Moves the public HoverEffect export to come from ./HoverEffect instead of the legacy hover gesture module.
packages/react-native-gesture-handler/src/HoverEffect.ts Introduces the new standalone HoverEffect enum definition.
packages/react-native-gesture-handler/src/handlers/gestures/hoverGesture.ts Removes the inline HoverEffect enum and references the extracted type instead.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 148 to 152
export type { TapGestureHandlerProps } from './handlers/TapGestureHandler';
export { TapGestureHandler } from './handlers/TapGestureHandler';
export { HoverEffect } from './HoverEffect';
export { PointerType } from './PointerType';
export { State } from './State';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I haven't commited them. Removed from description

@m-bert
m-bert requested a review from j-piasecki August 5, 2026 08:03
@m-bert
m-bert merged commit 286b374 into main Aug 5, 2026
5 checks passed
@m-bert
m-bert deleted the @mbert/extract-hover-effect branch August 5, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants