Hide autocomplete suggestions when input loses focus (#10989)
This commit is contained in:
@@ -27,6 +27,10 @@ export function DesktopSearch() {
|
|||||||
if (query.length) setActive(true)
|
if (query.length) setActive(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onBlur = () => {
|
||||||
|
setActive(false)
|
||||||
|
}
|
||||||
|
|
||||||
const onChangeText = (text: string) => {
|
const onChangeText = (text: string) => {
|
||||||
setQuery(text)
|
setQuery(text)
|
||||||
if (!active) {
|
if (!active) {
|
||||||
@@ -64,6 +68,7 @@ export function DesktopSearch() {
|
|||||||
hotkey
|
hotkey
|
||||||
value={query}
|
value={query}
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
|
onBlur={onBlur}
|
||||||
onChangeText={onChangeText}
|
onChangeText={onChangeText}
|
||||||
onClearText={onClearText}
|
onClearText={onClearText}
|
||||||
onSubmitEditing={onSubmit}
|
onSubmitEditing={onSubmit}
|
||||||
|
|||||||
Reference in New Issue
Block a user