UNPKG

2.8 kBTypeScriptView Raw
1import * as React from 'react';
2import { StyleProp, TextInput, TextInputProps, ViewStyle, TextStyle } from 'react-native';
3import type { IconSource } from './Icon';
4declare type Props = React.ComponentPropsWithRef<typeof TextInput> & {
5 /**
6 * Accessibility label for the button. This is read by the screen reader when the user taps the button.
7 */
8 clearAccessibilityLabel?: string;
9 /**
10 * Accessibility label for the button. This is read by the screen reader when the user taps the button.
11 */
12 searchAccessibilityLabel?: string;
13 /**
14 * Hint text shown when the input is empty.
15 */
16 placeholder?: string;
17 /**
18 * The value of the text input.
19 */
20 value: string;
21 /**
22 * Icon name for the left icon button (see `onIconPress`).
23 */
24 icon?: IconSource;
25 /**
26 * Callback that is called when the text input's text changes.
27 */
28 onChangeText?: (query: string) => void;
29 /**
30 * Callback to execute if we want the left icon to act as button.
31 */
32 onIconPress?: () => void;
33 /**
34 * Set style of the TextInput component inside the searchbar
35 */
36 inputStyle?: StyleProp<TextStyle>;
37 style?: StyleProp<ViewStyle>;
38 /**
39 * @optional
40 */
41 theme: ReactNativePaper.Theme;
42 /**
43 * Custom color for icon, default will be derived from theme
44 */
45 iconColor?: string;
46 /**
47 * Custom icon for clear button, default will be icon close
48 */
49 clearIcon?: IconSource;
50};
51declare type TextInputHandles = Pick<TextInput, 'setNativeProps' | 'isFocused' | 'clear' | 'blur' | 'focus'>;
52declare const _default: React.ComponentType<Pick<Pick<Props, "icon" | "key" | "theme" | keyof TextInputProps | "clearAccessibilityLabel" | "clearIcon" | "iconColor" | "inputStyle" | "onIconPress" | "searchAccessibilityLabel"> & React.RefAttributes<TextInputHandles>, "icon" | keyof TextInputProps | "clearAccessibilityLabel" | "clearIcon" | "iconColor" | "inputStyle" | "onIconPress" | "searchAccessibilityLabel" | keyof React.RefAttributes<TextInputHandles>> & {
53 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
54}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Pick<Props, "icon" | "key" | "theme" | keyof TextInputProps | "clearAccessibilityLabel" | "clearIcon" | "iconColor" | "inputStyle" | "onIconPress" | "searchAccessibilityLabel"> & React.RefAttributes<TextInputHandles>> & React.ForwardRefExoticComponent<Pick<Props, "icon" | "key" | "theme" | keyof TextInputProps | "clearAccessibilityLabel" | "clearIcon" | "iconColor" | "inputStyle" | "onIconPress" | "searchAccessibilityLabel"> & React.RefAttributes<TextInputHandles>>, {}>;
55export default _default;