import React, { type ComponentProps } from 'react'; import { type ViewStyle } from 'react-native'; import { type AnimatableValue, type SharedValue } from 'react-native-reanimated'; import type { PressableConfig } from '../provider/constants'; import type { AnimatedPressableOptions, PressableContextType } from '../provider/context'; declare const AnimatedBaseButton: React.FunctionComponent & React.RefAttributes>>>; type AnimatedPressableProps = ComponentProps; export type AnimatedPressableStyleOptions = { isPressed: boolean; isToggled: boolean; isSelected: boolean; /** * Required here (unlike the optional `metadata` in the press-handler * options): the themed `animatedStyle` pattern assumes you set `metadata` on * PressablesConfig, and typing it optional would force `?.` into every * existing worklet. Handlers, by contrast, may run on a pressable that never * set metadata, so there it is optional. */ metadata: TMetadata; config: PressableConfig; /** * Pre-configured animation function (withTiming or withSpring with config already applied) * Supports numbers, strings (colors), and other animatable values * @example * const opacity = withAnimation(isToggled ? 0.5 : 1); * const backgroundColor = withAnimation(isPressed ? '#ff0000' : '#0000ff'); */ withAnimation: (value: T) => T; }; export type PressableChildrenCallbackParams = { /** * Animation progress from 0 (idle) to 1 (pressed) */ progress: SharedValue; /** * Whether the pressable is currently being pressed */ isPressed: SharedValue; /** * Toggle state - flips on each press */ isToggled: SharedValue; /** * Whether this pressable is the last one pressed in the group */ isSelected: SharedValue; /** * Pre-configured animation function (withTiming or withSpring with config already applied) * Supports numbers, strings (colors), and other animatable values * @example * const opacity = useDerivedValue(() => withAnimation(isPressed.value ? 0.5 : 1)); * const backgroundColor = useDerivedValue(() => withAnimation(isPressed.value ? '#ff0000' : '#0000ff')); */ withAnimation: (value: T) => T; }; export type BasePressableProps = { children?: React.ReactNode | ((params: PressableChildrenCallbackParams) => React.ReactNode); animatedStyle?: (progress: number, options: AnimatedPressableStyleOptions) => ViewStyle; /** * Whether the pressable is interactive. * @deprecated Use `disabled` instead. */ enabled?: boolean; /** Disables the pressable. Takes precedence over `enabled`. */ disabled?: boolean; /** * Native accessibility identifier used by e2e runners (Maestro, XCUITest, * Detox). Defaults to `testID` when omitted. */ accessibilityIdentifier?: string; /** * Per-component metadata, surfaced to `animatedStyle` and to the press * handler options (including globalHandlers). Use it to identify a pressable * inside a global handler (e.g. analytics name) or carry flags it reacts to. * * REPLACES (does not merge with) the `metadata` set on PressablesConfig. * To combine both, spread them yourself: * `metadata={{ ...theme, name: 'checkout' }}`. */ metadata?: TMetadata; /** * Opt this pressable out of the globalHandlers defined on PressablesConfig. * The component's own onPress/onPressIn/onPressOut still fire. */ skipGlobalHandlers?: boolean; initialToggled?: boolean; /** * Activates the pressable animation on hover (web only) * @platform web */ activateOnHover?: boolean; } & Omit>, 'metadata' | 'config'> & Partial> & { onPress?: (options: AnimatedPressableOptions) => void; onPressIn?: (options: AnimatedPressableOptions) => void; onPressOut?: (options: AnimatedPressableOptions) => void; }; declare const BasePressable: React.FC; export { BasePressable }; //# sourceMappingURL=base.d.ts.map