Methods
const box = useRef<Search>(null);
<Search ref={box} onSearch={find} />;
await box.current?.focus('shoes');await box.current?.search();| Method | |
|---|---|
focus(text = '') |
Replaces the text and focuses. Without an argument it clears the text. |
blur() |
Takes the focus away and keeps the text. |
search() |
Runs the search, as the return key does. onSearch() is the same. |
getText() |
The text in the box. |
getInputRef() |
The underlying TextInput. |
onFocus() |
Focuses and expands, keeping the text. |
onChangeText(text) |
Changes the text as if it had been typed. |
onDelete() |
Presses the clear button. |
onCancel() |
Presses Cancel. |
expandAnimation() / collapseAnimation() |
Expands or collapses without the callbacks. |