Skip to content

Commit 8552259

Browse files
committed
fix: fix close others
1 parent f5dd452 commit 8552259

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ export const AutocompleteDropdown = memo<
230230

231231
const closeAll = useCallback(() => {
232232
controllerRefs?.current.forEach(c => {
233+
c?.blur?.()
233234
c?.close?.()
234235
})
235236
}, [controllerRefs])
@@ -391,10 +392,9 @@ export const AutocompleteDropdown = memo<
391392
if (typeof onFocusProp === 'function') {
392393
onFocusProp(e)
393394
}
394-
closeAll()
395395
open()
396396
},
397-
[clearOnFocus, closeAll, onFocusProp, open],
397+
[clearOnFocus, onFocusProp, open],
398398
)
399399

400400
const onBlur = useCallback(
@@ -422,13 +422,14 @@ export const AutocompleteDropdown = memo<
422422

423423
const onPressOut = useCallback(
424424
(e: GestureResponderEvent) => {
425+
closeAll()
425426
if (editable) {
426427
inputRef?.current?.focus()
427428
} else {
428429
toggle()
429430
}
430431
},
431-
[editable, toggle],
432+
[closeAll, editable, toggle],
432433
)
433434

434435
useEffect(() => {

0 commit comments

Comments
 (0)