From f7d19008dfa0ca6f68986396776ed57a533c5fba Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Tue, 24 Oct 2023 19:15:19 +0200 Subject: [PATCH 1/3] update options on transition end --- src/pages/SearchPage.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/SearchPage.js b/src/pages/SearchPage.js index 272fb30de858..f0796ffb7000 100755 --- a/src/pages/SearchPage.js +++ b/src/pages/SearchPage.js @@ -65,15 +65,13 @@ class SearchPage extends Component { this.searchRendered = this.searchRendered.bind(this); this.selectReport = this.selectReport.bind(this); this.onChangeText = this.onChangeText.bind(this); + this.updateOptions = this.updateOptions.bind(this); this.debouncedUpdateOptions = _.debounce(this.updateOptions.bind(this), 75); - - const {recentReports, personalDetails, userToInvite} = OptionsListUtils.getSearchOptions(props.reports, props.personalDetails, '', props.betas); - this.state = { searchValue: '', - recentReports, - personalDetails, - userToInvite, + recentReports: {}, + personalDetails: {}, + userToInvite: {}, }; } @@ -186,6 +184,7 @@ class SearchPage extends Component { {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( <> From 0e4411cff508bdad6b54f855e843156699d98981 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Tue, 24 Oct 2023 19:15:20 +0200 Subject: [PATCH 2/3] remove timeout on search focus --- src/components/OptionsSelector/BaseOptionsSelector.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index 0125fc8e178e..5e37db057db5 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -75,9 +75,7 @@ class BaseOptionsSelector extends Component { this.subscribeToKeyboardShortcut(); if (this.props.isFocused && this.props.autoFocus && this.textInput) { - this.focusTimeout = setTimeout(() => { - this.textInput.focus(); - }, CONST.ANIMATED_TRANSITION); + this.textInput.focus(); } this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false); @@ -139,10 +137,6 @@ class BaseOptionsSelector extends Component { } componentWillUnmount() { - if (this.focusTimeout) { - clearTimeout(this.focusTimeout); - } - this.unSubscribeFromKeyboardShortcut(); } From aeba2749a2da05e3188c0fb9998dec42ad770aa8 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 25 Oct 2023 09:11:29 +0200 Subject: [PATCH 3/3] 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(); }