Skip to content

fix(tooltip): propagate press event object to onPress (#5003)#5009

Open
Shevilll wants to merge 1 commit into
callstack:mainfrom
Shevilll:fix/tooltip-propagate-press-event
Open

fix(tooltip): propagate press event object to onPress (#5003)#5009
Shevilll wants to merge 1 commit into
callstack:mainfrom
Shevilll:fix/tooltip-propagate-press-event

Conversation

@Shevilll

Copy link
Copy Markdown

Summary

Fixes #5003

On native, Tooltip's internal handlePress was defined as () => { ...; props.onPress?.() }, which dropped the GestureResponderEvent before forwarding to the wrapped child's onPress. As a result, any child rendered inside a Tooltip received undefined instead of the press event object, breaking handlers that rely on event.nativeEvent (e.g. reading touch coordinates).

What changed

  • Tooltip.tsx: handlePress now accepts the GestureResponderEvent and threads it through to props.onPress?.(e).
  • utils.ts: widened TooltipChildProps.onPress from () => void to (e: GestureResponderEvent) => void so the event type is correct end-to-end.

No behavior change for the tooltip show/hide flow; this only restores the event argument that was previously swallowed. onLongPress/hover handlers are unaffected.

Why

Consumers expect a tooltip-wrapped element to behave like the element itself. Swallowing the press event silently breaks that contract on native.

Verification

  • Added a unit test asserting the press event object reaches the child onPress (verified it fails on main with "called with 0 arguments" and passes with this change).
  • yarn jest src/components/__tests__/Tooltip.test.tsx → 18/18 pass.
  • yarn typescript → passes.
  • yarn lint on changed files → passes.

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.

Tooltip: onPress event object is not propagated to parent component on native

1 participant