import { ComponentType } from "react" import { Pressable, PressableProps, PressableStateCallbackType, StyleProp, TextStyle, ViewStyle, } from "react-native" import { useAppTheme } from "@/theme/context" import { $styles } from "@/theme/styles" import type { ThemedStyle, ThemedStyleArray } from "@/theme/types" import { Text, TextProps } from "./Text" type Presets = "default" | "filled" | "reversed" export interface ButtonAccessoryProps { style: StyleProp pressableState: PressableStateCallbackType disabled?: boolean } export interface ButtonProps extends PressableProps { /** * Text which is looked up via i18n. */ tx?: TextProps["tx"] /** * The text to display if not using `tx` or nested components. */ text?: TextProps["text"] /** * Optional options to pass to i18n. Useful for interpolation * as well as explicitly setting locale or translation fallbacks. */ txOptions?: TextProps["txOptions"] /** * An optional style override useful for padding & margin. */ style?: StyleProp /** * An optional style override for the "pressed" state. */ pressedStyle?: StyleProp /** * An optional style override for the button text. */ textStyle?: StyleProp /** * An optional style override for the button text when in the "pressed" state. */ pressedTextStyle?: StyleProp /** * An optional style override for the button text when in the "disabled" state. */ disabledTextStyle?: StyleProp /** * One of the different types of button presets. */ preset?: Presets /** * An optional component to render on the right side of the text. * Example: `RightAccessory={(props) => }` */ RightAccessory?: ComponentType /** * An optional component to render on the left side of the text. * Example: `LeftAccessory={(props) => }` */ LeftAccessory?: ComponentType /** * Children components. */ children?: React.ReactNode /** * disabled prop, accessed directly for declarative styling reasons. * https://reactnative.dev/docs/pressable#disabled */ disabled?: boolean /** * An optional style override for the disabled state */ disabledStyle?: StyleProp } /** * A component that allows users to take actions and make choices. * Wraps the Text component with a Pressable component. * @see [Documentation and Examples]{@link https://docs.infinite.red/ignite-cli/boilerplate/app/components/Button/} * @param {ButtonProps} props - The props for the `Button` component. * @returns {JSX.Element} The rendered `Button` component. * @example *