Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Jest mock export for the Clickable component within the gesture button mocks, intended to simplify testing usage of Clickable in environments using the library’s mocks.
Changes:
- Export
Clickablefromsrc/mocks/GestureButtons.tsxas an alias ofRawButton.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const RectButton = RawButton; | ||
| export const BorderlessButton = TouchableNativeFeedback; | ||
| export const Clickable = RawButton; |
There was a problem hiding this comment.
Clickable is a v3 export (src/v3/components/index.ts -> src/v3/components/Clickable/Clickable), but this mock file is used to mock ./src/components/GestureButtons (legacy) in jestSetup.js. Exporting Clickable here likely won’t affect import { Clickable } from 'react-native-gesture-handler' in tests, so the PR may not actually provide a Jest mock for the public Clickable API. Consider adding a dedicated v3 Clickable mock and wiring it up in jestSetup.js (e.g., mock ./src/v3/components/Clickable/Clickable or ./src/v3/components).
packages/react-native-gesture-handler/src/mocks/GestureButtons.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-gesture-handler/src/mocks/v3GestureComponents.tsx
Outdated
Show resolved
Hide resolved
| jest.mock('./lib/commonjs/v3/components/Clickable/Clickable', () => | ||
| require('./lib/commonjs/mocks/v3GestureComponents') | ||
| ); | ||
| jest.mock('./lib/commonjs/v3/components/GestureButtons', () => | ||
| require('./lib/commonjs/mocks/v3GestureComponents') | ||
| ); | ||
| jest.mock('./lib/commonjs/v3/components/Pressable', () => | ||
| require('./lib/commonjs/mocks/Pressable') | ||
| ); | ||
| jest.mock('./lib/commonjs/v3/components/GestureComponents', () => | ||
| require('./lib/commonjs/mocks/v3GestureComponents') | ||
| ); |
There was a problem hiding this comment.
jestSetup.js mocks v3 components only for ./lib/commonjs/... and ./lib/module/..., but not for the ./src/v3/components/... entrypoints. Since the package publishes src/ and also has a react-native entry (package.json:22) that can be used by React Native/Jest resolvers, consumers may still hit the unmocked ./src/v3/components/* implementations in tests. Add equivalent jest.mock('./src/v3/components/...') entries for Clickable, GestureButtons, Pressable, and GestureComponents to keep source and built entrypoints consistent.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
This PR:
react-native-workletsmock from ourjestSetupTest plan
New
mocktestAlso tested on this test code in new app: