import { ClassAttributes, ComponentProps, ComponentType } from "react"; import { Pressable as NativePressable, StyleProp, PressableStateCallbackType as NativePressableStateCallbackType, } from "react-native"; import { ViewStyle } from "./View"; type NativePressableProps = ComponentProps & ClassAttributes; export type PressableStateCallbackType = NativePressableStateCallbackType & { readonly pressed: boolean; /** @platform web */ readonly hovered: boolean; /** @platform web */ readonly focused: boolean; }; export type WebPressableProps = { /** * Either children or a render prop that receives a boolean reflecting whether * the component is currently pressed. */ children?: | React.ReactNode | ((state: PressableStateCallbackType) => React.ReactNode); /** * Either view styles or a function that receives a boolean reflecting whether * the component is currently pressed and returns view styles. */ style?: | StyleProp | ((state: PressableStateCallbackType) => StyleProp); }; export type PressableProps = Omit & WebPressableProps; export const Pressable = NativePressable as ComponentType;