UNPKG

1.76 kBTypeScriptView Raw
1import { Component } from 'react';
2import { TouchableOpacityProps, ViewStyle, StyleProp, TextStyle, TextInput } from 'react-native';
3import { InputProps } from '../input/Input';
4import { SearchBarBaseProps } from './SearchBar';
5import { ThemeProps } from '../config';
6export declare type SearchBarIosProps = InputProps & SearchBarBaseProps & typeof SearchBar.defaultProps & {
7 cancelButtonProps?: Partial<TouchableOpacityProps> & {
8 buttonStyle?: StyleProp<ViewStyle>;
9 buttonTextStyle?: StyleProp<TextStyle>;
10 color?: string;
11 buttonDisabledStyle?: StyleProp<ViewStyle>;
12 buttonDisabledTextStyle?: StyleProp<ViewStyle>;
13 };
14 cancelButtonTitle?: string;
15 showCancel?: boolean;
16};
17declare type SearchBarState = {
18 hasFocus: boolean;
19 isEmpty: boolean;
20 cancelButtonWidth: number | null;
21};
22declare class SearchBar extends Component<SearchBarIosProps & Partial<ThemeProps<SearchBarIosProps>>, SearchBarState> {
23 input: TextInput;
24 static defaultProps: {
25 value: string;
26 cancelButtonTitle: string;
27 loadingProps: {};
28 cancelButtonProps: {};
29 showLoading: boolean;
30 onClear: () => any;
31 onCancel: () => any;
32 onFocus: () => any;
33 onBlur: () => any;
34 onChangeText: () => any;
35 searchIcon: {
36 name: string;
37 };
38 clearIcon: {
39 name: string;
40 };
41 showCancel: boolean;
42 };
43 constructor(props: SearchBarIosProps);
44 focus: () => void;
45 blur: () => void;
46 clear: () => void;
47 cancel: () => void;
48 onFocus: InputProps['onFocus'];
49 onBlur: InputProps['onBlur'];
50 onChangeText: (text: string) => void;
51 render(): JSX.Element;
52}
53export default SearchBar;