import React from "react"; import { TextInput as NativeTextInput, TextInputProps as NativeTextInputProps, Platform, } from "react-native"; import { useDebounce, useOnUpdate } from "../hooks"; import { useTheme } from "@draftbit/theme"; export interface TextInputProps extends NativeTextInputProps { webShowOutline?: boolean; onChangeTextDelayed?: (text: string) => void; changeTextDelay?: number; disabled?: boolean; } const TextInput = React.forwardRef( ( { onChangeTextDelayed, changeTextDelay = 500, webShowOutline = true, style, disabled = false, editable = true, value, onChangeText, ...rest }, ref ) => { const theme = useTheme(); const [valueToDebounce, setValueToDebounce] = React.useState(value); const delayedValue = useDebounce(valueToDebounce, changeTextDelay); useOnUpdate(() => { if (delayedValue !== undefined) { onChangeTextDelayed?.(delayedValue); } }, [delayedValue]); return (