All props are optional. New marks what 1.0 added. Every before*, on* and after* callback may return a promise, and the next one waits for it.
| Prop |
Type |
Default |
|
defaultValue |
string |
'' |
Text shown on mount. |
value |
string |
|
New. Text of the box. The box follows it whenever it changes, and reports clearing through onChangeText. |
placeholder |
string |
'Search' |
Shown while empty. |
cancelTitle |
ReactNode |
'Cancel' |
Title of the Cancel button. |
autoFocus |
boolean |
false |
Focus on mount, and whenever it turns on. |
editable |
boolean |
true |
Whether the text can be changed. |
blurOnSubmit |
boolean |
true |
Blur on the return key. |
returnKeyType |
string |
'search' |
As on TextInput. |
keyboardType |
string |
'default' |
As on TextInput. |
keyboardAppearance |
'default' | 'light' | 'dark' |
'default' |
iOS keyboard color. |
autoCapitalize |
string |
|
As on TextInput. |
selectionColor |
string |
|
Color of the cursor and the selection. |
textInputProps |
TextInputProps |
|
New. Any other TextInput prop, such as maxLength. |
| Prop |
Type |
Default |
|
showCancelButton |
boolean |
true |
New. Show Cancel while expanded. |
useClearButton |
boolean |
true |
Show the clear (×) button. |
keyboardShouldPersist |
boolean |
false |
Keep the keyboard open on search and Cancel. |
collapseOnBlur |
boolean |
false |
New. Collapse when the focus is lost. The text is kept. |
searchDelay |
number |
|
New. Run the search this many ms after typing stops. |
animated |
boolean |
true |
New. false moves without animation. |
animationDuration |
number |
200 |
New. Milliseconds. |
placeholderAlign |
'center' | 'left' |
'center' |
New. Where the icon and the placeholder rest. |
direction |
'ltr' | 'rtl' |
'ltr' |
Mirrors the layout. |
| Prop |
Type |
Default |
|
beforeFocus |
() => any |
|
Before the box expands. |
onFocus |
(text) => any |
|
The box got the focus. |
afterFocus |
() => any |
|
After onFocus. |
beforeBlur |
() => any |
|
New. Before onBlur. |
onBlur |
(text) => any |
|
New. The box lost the focus. |
afterBlur |
() => any |
|
New. After onBlur. |
beforeSearch |
(text) => any |
|
Before the keyboard closes. |
onSearch |
(text) => any |
|
Return key, search(), or searchDelay. |
afterSearch |
(text) => any |
|
After onSearch. |
onChangeText |
(text) => any |
|
The user typed. With value, also when the text is cleared. |
beforeDelete |
() => any |
|
Before the clear button clears. |
onDelete |
() => any |
|
The clear button was pressed. |
afterDelete |
() => any |
|
After onDelete. |
beforeCancel |
() => any |
|
Before Cancel clears and collapses. |
onCancel |
() => any |
|
Cancel was pressed. Losing the focus does not call it. |
afterCancel |
() => any |
|
After onCancel. |
onEndEditing |
(text) => any |
|
New. Editing ended. |
onLayout |
(event) => void |
|
The box was laid out. |
| Prop |
Type |
Default |
|
backgroundColor |
string |
'grey' |
Background of the box. |
containerStyle |
ViewStyle |
|
New. Outer box: margin, flex, border. Its padding stays 5. |
inputStyle |
TextStyle |
|
The input. |
inputHeight |
number |
30 |
Falls back to inputStyle.height. |
inputBorderRadius |
number |
5 |
Corner radius of the input. |
placeholderTextColor |
string |
'grey' |
Also colors the text, unless inputStyle.color is set. |
titleCancelColor |
string |
'#fff' |
Color of the Cancel title. |
tintColorSearch |
string |
'grey' |
Color of the default search icon. |
tintColorDelete |
string |
'grey' |
Color of the default clear icon. |
iconSearch |
ReactElement |
|
Replaces the search icon. |
iconDelete |
ReactElement |
|
Replaces the clear icon. |
cancelButtonWidth |
number |
measured |
Room for Cancel. Measured from the title, at least 70. |
cancelButtonStyle |
TextStyle |
|
View and text of Cancel. Prefer the next two. |
cancelButtonViewStyle |
ViewStyle |
|
View of Cancel. |
cancelButtonTextStyle |
TextStyle |
|
Text of Cancel. |
contentWidth |
number |
window |
Width assumed until the first layout. |
middleWidth |
number |
half |
Center assumed until the first layout. |
| Prop |
Type |
Default |
|
searchIconCollapsedMargin |
number |
25 |
Icon to center, collapsed. |
searchIconExpandedMargin |
number |
10 |
Icon to edge, expanded. |
placeholderCollapsedMargin |
number |
15 |
Placeholder to center, collapsed. Half its width centers it. |
placeholderExpandedMargin |
number |
20 |
Text to edge, expanded. |
positionRightDelete |
number |
|
Clear button to the trailing edge. |
| Prop |
Type |
Default |
|
shadowVisible |
boolean |
false |
iOS and web. |
shadowColor |
string |
'#000' |
|
shadowRadius |
number |
4 |
|
shadowOffsetWidth |
number |
0 |
|
shadowOffsetHeightCollapsed |
number |
2 |
|
shadowOffsetHeightExpanded |
number |
4 |
|
shadowOpacityCollapsed |
number |
0.12 |
|
shadowOpacityExpanded |
number |
0.24 |
|
| Prop |
Type |
Default |
|
maxFontSizeMultiplierForInput |
number |
|
New. Limits the system font scale of the input. |
maxFontSizeMultiplierForCancel |
number |
|
New. The same for Cancel. |
clearButtonAccessibilityLabel |
string |
'Clear' |
New. Read by screen readers. |
testID |
string |
|
New. The box. |
inputTestID |
string |
|
New. The input. |
searchIconTestID |
string |
|
New. The search icon. |
clearButtonTestID |
string |
|
New. The clear button. |
cancelButtonTestID |
string |
|
New. The Cancel button. |