-
Notifications
You must be signed in to change notification settings - Fork 212
/
index.d.ts
187 lines (159 loc) · 3.24 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import * as React from 'react';
import {
ReturnKeyType,
ReturnKeyTypeIOS,
KeyboardType,
KeyboardTypeIOS,
ViewStyle,
StyleProp,
} from 'react-native';
interface Props {
/**
* Text for the placeholder
*
* Default is 'Search'
*/
placeholder?: string;
/**
* Text in the search bar
*/
text?: string;
/**
* Background color of the search bar
*/
barTintColor?: string;
/**
* Color of the Cancel button, highlight and cursor
*/
tintColor?: string;
/**
* Textfield text color
*/
textColor?: string;
/**
* Textfield background color
*/
textFieldBackgroundColor?: string;
/**
* Toggles whether to show the cancel button or not
*
* Default is false
*/
showsCancelButton?: boolean;
/**
* String for the cancel button
*
* Default is 'Cancel'
*/
cancelButtonText?: string;
/**
* Only shows the cancel button while the search bar has focus
*
* Default is true
*/
showsCancelButtonWhileEditing?: boolean;
/**
* Indicates whether the Return key is automatically enabled when the user is entering text.
*
* Default is true
*/
enablesReturnKeyAutomatically?: boolean;
/**
* Indicates whether just to show the text input only
*
* Default is false
*/
hideBackground?: boolean;
/**
* Style of the bar
*
* Default is 'default'
*/
barStyle?: 'default' | 'black';
/**
* Style of the search bar
*
* Default is 'default'
*/
searchBarStyle?: 'default' | 'prominent' | 'minimal';
/**
* Toggles if the user can interact with the search bar
*
* Default is true
*/
editable?: boolean;
/**
* Return key type for the keyboard
*
* Default is 'search'
*/
returnKeyType?: ReturnKeyType | ReturnKeyTypeIOS;
/**
* The type of keyboard to display
*
* Default is 'default'
*/
keyboardType?: KeyboardType | KeyboardTypeIOS;
/**
* The appearance of the keyboard
*
* Default is 'default'
*/
keyboardAppearance?: 'default' | 'dark' | 'light';
/**
* The auto-capitalization behavior
*
* Default is 'sentences'
*/
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
/**
* If autoCorrect is enabled
*
* Default is false
*/
autoCorrect?: boolean;
/**
* If red underline is shown for misspelt words
*
* Default is false
*/
spellCheck?: boolean;
/**
* Event fired when
*/
onChange?(event: { target: number; text: string; eventCount: number }): void;
/**
* Searchbar style
*/
style?: StyleProp<ViewStyle>;
/**
* Event fired when the text in the input changes
*
* Returns the current text value in the input
*/
onChangeText?(text: string): void;
/**
* Event fired when the text input is focused
*/
onFocus?(): void;
/**
* Event fired the input is blurred
*/
onBlur?(): void;
/**
* Event fired when the search button is pressed
*
* Returns the current text value in the input
*/
onSearchButtonPress?(text: string): void;
/**
* Event fired when the cancel button is pressed
*/
onCancelButtonPress?(): void;
}
export default class SearchBar extends React.Component<Props> {
focus(): void;
blur(): void;
unFocus(): void;
clearText(): void;
}