diff --git a/src/components/CountryPicker/CountrySelectorModal.js b/src/components/CountryPicker/CountrySelectorModal.js index 146b023bbf0c..d8fdfa157a18 100644 --- a/src/components/CountryPicker/CountrySelectorModal.js +++ b/src/components/CountryPicker/CountrySelectorModal.js @@ -81,7 +81,6 @@ function CountrySelectorModal({currentCountry, isVisible, onClose, onCountrySele sections={[{data: searchResults, indexOffset: 0}]} onSelectRow={onCountrySelected} onChangeText={setSearchValue} - shouldDelayFocus initiallyFocusedOptionKey={currentCountry} /> diff --git a/src/components/NewDatePicker/CalendarPicker/YearPickerModal.js b/src/components/NewDatePicker/CalendarPicker/YearPickerModal.js index 1149f9dc56ce..eed90e7b7d36 100644 --- a/src/components/NewDatePicker/CalendarPicker/YearPickerModal.js +++ b/src/components/NewDatePicker/CalendarPicker/YearPickerModal.js @@ -70,7 +70,6 @@ function YearPickerModal(props) { onBackButtonPress={props.onClose} /> { - if (shouldShowTextInput) { - if (shouldDelayFocus) { + /** Focuses the text input when the component comes into focus and after any navigation animations finish. */ + useFocusEffect( + useCallback(() => { + if (shouldShowTextInput) { focusTimeoutRef.current = setTimeout(() => textInputRef.current.focus(), CONST.ANIMATED_TRANSITION); - } else { - textInputRef.current.focus(); - } - } - - return () => { - if (!focusTimeoutRef.current) { - return; } - clearTimeout(focusTimeoutRef.current); - }; - }, [shouldDelayFocus, shouldShowTextInput]); + return () => { + if (!focusTimeoutRef.current) { + return; + } + clearTimeout(focusTimeoutRef.current); + }; + }, [shouldShowTextInput]), + ); /** Selects row when pressing Enter */ useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, selectFocusedOption, { diff --git a/src/components/StatePicker/StateSelectorModal.js b/src/components/StatePicker/StateSelectorModal.js index 91ee1b225a1f..abd12c7f5e4e 100644 --- a/src/components/StatePicker/StateSelectorModal.js +++ b/src/components/StatePicker/StateSelectorModal.js @@ -86,7 +86,6 @@ function StateSelectorModal({currentState, isVisible, onClose, onStateSelected, sections={[{data: searchResults, indexOffset: 0}]} onSelectRow={onStateSelected} onChangeText={setSearchValue} - shouldDelayFocus initiallyFocusedOptionKey={currentState} /> diff --git a/src/pages/settings/Profile/PronounsPage.js b/src/pages/settings/Profile/PronounsPage.js index ce460bc30ff4..1706af1b9cac 100644 --- a/src/pages/settings/Profile/PronounsPage.js +++ b/src/pages/settings/Profile/PronounsPage.js @@ -109,7 +109,6 @@ function PronounsPage(props) { onSelectRow={updatePronouns} onChangeText={onChangeText} initiallyFocusedOptionKey={initiallyFocusedOption.keyForList} - shouldDelayFocus /> )} diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js index d0a50acdeb17..c29dd541afcd 100644 --- a/src/pages/settings/Profile/TimezoneSelectPage.js +++ b/src/pages/settings/Profile/TimezoneSelectPage.js @@ -78,7 +78,6 @@ function TimezoneSelectPage(props) { onSelectRow={saveSelectedTimezone} sections={[{data: timezoneOptions, indexOffset: 0, isDisabled: timezone.automatic}]} initiallyFocusedOptionKey={_.get(_.filter(timezoneOptions, (tz) => tz.text === timezone.selected)[0], 'keyForList')} - shouldDelayFocus showScrollIndicator /> diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index 6db3a20a3e4a..4626a3f171eb 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -227,7 +227,6 @@ function WorkspaceInvitePage(props) { onSelectRow={toggleOption} onConfirm={inviteUser} showScrollIndicator - shouldDelayFocus showLoadingPlaceholder={!didScreenTransitionEnd || !OptionsListUtils.isPersonalDetailsReady(props.personalDetails)} /> diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js index d598f90e4326..53ddd0fb5d96 100644 --- a/src/pages/workspace/WorkspaceMembersPage.js +++ b/src/pages/workspace/WorkspaceMembersPage.js @@ -393,7 +393,6 @@ function WorkspaceMembersPage(props) { onSelectAll={() => toggleAllUsers(data)} onDismissError={dismissError} showLoadingPlaceholder={!OptionsListUtils.isPersonalDetailsReady(props.personalDetails) || _.isEmpty(props.policyMembers)} - shouldDelayFocus showScrollIndicator />