'use client'; /* eslint-disable */ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type { ViewProps, ColorValue, HostComponent } from 'react-native'; import type { WithDefault, DirectEventHandler, } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; export type SearchBarEvent = Readonly<{}>; export type SearchButtonPressedEvent = Readonly<{ text?: string; }>; export type ChangeTextEvent = Readonly<{ text?: string; }>; type SearchBarPlacement = | 'automatic' | 'inline' // deprecated starting from iOS 26 | 'stacked' | 'integrated' | 'integratedButton' | 'integratedCentered'; type AutoCapitalizeType = 'none' | 'words' | 'sentences' | 'characters'; export interface NativeProps extends ViewProps { onSearchFocus?: DirectEventHandler | null; onSearchBlur?: DirectEventHandler | null; onSearchButtonPress?: DirectEventHandler | null; onCancelButtonPress?: DirectEventHandler | null; onChangeText?: DirectEventHandler | null; hideWhenScrolling?: WithDefault; autoCapitalize?: WithDefault; placeholder?: string; placement?: WithDefault; allowToolbarIntegration?: WithDefault; obscureBackground?: boolean; hideNavigationBar?: boolean; cancelButtonText?: string; // TODO: implement these on iOS barTintColor?: ColorValue; tintColor?: ColorValue; textColor?: ColorValue; // Android only disableBackButtonOverride?: boolean; // TODO: consider creating enum here inputType?: string; onClose?: DirectEventHandler | null; onOpen?: DirectEventHandler | null; hintTextColor?: ColorValue; headerIconColor?: ColorValue; shouldShowHintSearchIcon?: WithDefault; } type ComponentType = HostComponent; interface NativeCommands { blur: (viewRef: React.ElementRef) => void; focus: (viewRef: React.ElementRef) => void; clearText: (viewRef: React.ElementRef) => void; toggleCancelButton: ( viewRef: React.ElementRef, flag: boolean, ) => void; setText: (viewRef: React.ElementRef, text: string) => void; cancelSearch: (viewRef: React.ElementRef) => void; } export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: [ 'blur', 'focus', 'clearText', 'toggleCancelButton', 'setText', 'cancelSearch', ], }); export default codegenNativeComponent('RNSSearchBar', {});