Extract HoverEffect to a standalone module - #4379
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe ChangesHoverEffect module extraction
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
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
HoverEffectmodule exporting the enum with stable numeric values (0/1/2). - Updated v3 hover types to import
HoverEffectfrom the new standalone module instead of the legacy hover gesture module. - Updated the package barrel export (
src/index.ts) to re-exportHoverEffectfrom 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.
| export type { TapGestureHandlerProps } from './handlers/TapGestureHandler'; | ||
| export { TapGestureHandler } from './handlers/TapGestureHandler'; | ||
| export { HoverEffect } from './HoverEffect'; | ||
| export { PointerType } from './PointerType'; | ||
| export { State } from './State'; |
There was a problem hiding this comment.
Yep, I haven't commited them. Removed from description
Description
HoverEffectmoves fromhandlers/gestures/hoverGesture.tsto a standalonesrc/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-checkclean;yarn testgreen (103 + 3 new);yarn lint:js0 errorsHoverEffectfrom the barrel at module scope and passesHoverEffect.LIFTas a config value — mounts and renders cleanly