From aeba2749a2da05e3188c0fb9998dec42ad770aa8 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 25 Oct 2023 09:11:29 +0200 Subject: [PATCH] Revert "remove timeout on search focus" This reverts commit 0e4411cff508bdad6b54f855e843156699d98981. --- src/components/OptionsSelector/BaseOptionsSelector.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index 5e37db057db5..0125fc8e178e 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -75,7 +75,9 @@ class BaseOptionsSelector extends Component { this.subscribeToKeyboardShortcut(); if (this.props.isFocused && this.props.autoFocus && this.textInput) { - this.textInput.focus(); + this.focusTimeout = setTimeout(() => { + this.textInput.focus(); + }, CONST.ANIMATED_TRANSITION); } this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false); @@ -137,6 +139,10 @@ class BaseOptionsSelector extends Component { } componentWillUnmount() { + if (this.focusTimeout) { + clearTimeout(this.focusTimeout); + } + this.unSubscribeFromKeyboardShortcut(); }