-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Typed gesture hooks #3706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typed gesture hooks #3706
Conversation
export type { ManualGestureConfig } from './useManual'; | ||
export { useManual } from './useManual'; | ||
|
||
export type { NativeViewGestureConfig } from './useNative'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can change to NativeGestureConfig
(or something else) if you prefer.
There was a problem hiding this comment.
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 introduces typed gesture hooks for a new v3 API in react-native-gesture-handler. The changes add strongly-typed hooks for various gesture types (tap, pan, pinch, rotation, etc.) with proper TypeScript support.
- Adds typed hook functions for all major gesture types (tap, pan, pinch, rotation, fling, hover, etc.)
- Implements proper TypeScript generics and type safety throughout the hook system
- Adds utility functions for configuration handling and property mapping
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
packages/react-native-gesture-handler/src/v3/types.ts | Updates type definitions with generics and new config types |
packages/react-native-gesture-handler/src/v3/hooks/utils/relationUtils.ts | Adds generic types to isComposedGesture function |
packages/react-native-gesture-handler/src/v3/hooks/utils.ts | Adds utility functions for config cloning and property remapping |
packages/react-native-gesture-handler/src/v3/hooks/gestures/*.ts | Implements typed hooks for all gesture types (tap, pan, pinch, etc.) |
packages/react-native-gesture-handler/src/v3/NativeDetector/*.ts | Updates NativeDetector components with proper generic typing |
packages/react-native-gesture-handler/src/index.ts | Exports the new gesture hooks |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Description
This PR introduces typed hooks for new API.
Test plan
Tested on the following example:
Also on other handlers.