/** * Builds the `forwardRef` wrapper that the `PressableTracker` * monkey-patch installs in place of `react-native`'s Pressable / * Touchable* exports. Kept in its own file so `PressableTracker.ts` * stays under the 150-line cap and so the wrapper-build concern * lives next to the related `pickButtonName` resolver. * * `forwardRef` is required so host code that uses `` keeps a valid ref to the underlying touchable. A * plain function component would silently drop the ref with a * dev-mode warning and break the host's `.focus()` / `.measure(...)` * calls. */ import type { PressableTrackerArgs } from './types/PressableTracker'; import { type ComponentType } from 'react'; /** * Loose touchable-component type. `Record` is the * widest prop type `createElement` accepts: the wrapper never reads * the props itself, it only intercepts `onPress`, so the precise * host Pressable prop shape is not part of our contract. Defined * once here and re-exported so `PressableTracker.ts` and tests share * one alias. */ type WrappedTouchable = ComponentType>; /** * Build a `forwardRef` wrapper around `Original` that intercepts * `onPress` and emits a BUTTON_CLICK event before delegating. Tagged * with `__keewanoWrapped` so `detach()` can verify the namespace * still points at our patch before restoring the original. */ declare function buildPressableWrapper(Original: WrappedTouchable, componentLabel: string, dispatcher: PressableTrackerArgs['dispatcher']): WrappedTouchable; export type { WrappedTouchable }; export { buildPressableWrapper };