You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3e4497e
Browse filesBrowse the repository at this point in the historyBrowse files
## Description
Follow-up to #4416. None of the `Pressable` engines forwarded hover
handlers as `testOnly_*` props, so `fireEvent(element, 'hoverIn')` from
React Native Testing Library had no way to reach
`onHoverIn`/`onHoverOut`. RNTL resolves `testOnly_on{EventName}`
generically for any event, so exposing the props is all that's needed.
This adds `testOnly_onHoverIn`/`testOnly_onHoverOut` to the button props
and forwards them, guarded by `isTestEnv()`, from all three engines:
legacy `Pressable`, `StatefulPressable` and `PressableWithTouchable`.
Also widens the relation props
(`simultaneousWith`/`requireToFail`/`block`) from `AnyGesture` to
`AnyGesture | AnyGesture[]`. The JSDoc already promises a gesture object
or an array of gesture objects and the runtime handles arrays in both
directions (`relationUtils` flattens them into handler tags and pushes
the symmetric relation onto each array element), only the prop type was
narrowed.
## Test plan
Added tests in `src/__tests__/mocks.test.tsx` asserting the hover props
are wired on the button for both v3 engines — relation-free and routed
to `StatefulPressable` via `simultaneousWith={[]}` (which the type
widening makes legal). Both fail without the engine changes.
In `packages/react-native-gesture-handler`: `yarn test`, `yarn ts-check`
and `yarn lint:js` pass.
0 commit comments