Skip to content

Commit 5752171

Browse files
committed
Revert areOptionsInitialized check in SearchAutocompleteList
1 parent 72b57f0 commit 5752171

1 file changed

Lines changed: 31 additions & 29 deletions

File tree

src/components/Search/SearchAutocompleteList.tsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -672,35 +672,37 @@ function SearchAutocompleteList(
672672
return (
673673
// On page refresh, when the list is rendered before options are initialized the auto-focusing on initiallyFocusedOptionKey
674674
// will fail because the list will be empty on first render so we only render after options are initialized.
675-
<SelectionList<OptionData | SearchQueryItem>
676-
showLoadingPlaceholder
677-
fixedNumItemsForLoader={4}
678-
loaderSpeed={CONST.TIMING.SKELETON_ANIMATION_SPEED}
679-
sections={sections}
680-
onSelectRow={onListItemPress}
681-
ListItem={SearchRouterItem}
682-
containerStyle={[styles.mh100]}
683-
sectionListStyle={[styles.ph2, styles.pb2, styles.overscrollBehaviorContain]}
684-
listItemWrapperStyle={[styles.pr0, styles.pl0]}
685-
getItemHeight={getItemHeight}
686-
onLayout={() => {
687-
setPerformanceTimersEnd();
688-
setIsInitialRender(false);
689-
if (!!textInputRef?.current && ref && 'current' in ref) {
690-
ref.current?.updateExternalTextInputFocus?.(textInputRef.current.isFocused());
691-
}
692-
}}
693-
showScrollIndicator={!shouldUseNarrowLayout}
694-
sectionTitleStyles={styles.mhn2}
695-
shouldSingleExecuteRowSelect
696-
onArrowFocus={onArrowFocus}
697-
ref={ref}
698-
initiallyFocusedOptionKey={!shouldUseNarrowLayout ? styledRecentReports.at(0)?.keyForList : undefined}
699-
shouldScrollToFocusedIndex={!isInitialRender}
700-
shouldSubscribeToArrowKeyEvents={shouldSubscribeToArrowKeyEvents}
701-
disableKeyboardShortcuts={!shouldSubscribeToArrowKeyEvents}
702-
addBottomSafeAreaPadding
703-
/>
675+
areOptionsInitialized && (
676+
<SelectionList<OptionData | SearchQueryItem>
677+
showLoadingPlaceholder
678+
fixedNumItemsForLoader={4}
679+
loaderSpeed={CONST.TIMING.SKELETON_ANIMATION_SPEED}
680+
sections={sections}
681+
onSelectRow={onListItemPress}
682+
ListItem={SearchRouterItem}
683+
containerStyle={[styles.mh100]}
684+
sectionListStyle={[styles.ph2, styles.pb2, styles.overscrollBehaviorContain]}
685+
listItemWrapperStyle={[styles.pr0, styles.pl0]}
686+
getItemHeight={getItemHeight}
687+
onLayout={() => {
688+
setPerformanceTimersEnd();
689+
setIsInitialRender(false);
690+
if (!!textInputRef?.current && ref && 'current' in ref) {
691+
ref.current?.updateExternalTextInputFocus?.(textInputRef.current.isFocused());
692+
}
693+
}}
694+
showScrollIndicator={!shouldUseNarrowLayout}
695+
sectionTitleStyles={styles.mhn2}
696+
shouldSingleExecuteRowSelect
697+
onArrowFocus={onArrowFocus}
698+
ref={ref}
699+
initiallyFocusedOptionKey={!shouldUseNarrowLayout ? styledRecentReports.at(0)?.keyForList : undefined}
700+
shouldScrollToFocusedIndex={!isInitialRender}
701+
shouldSubscribeToArrowKeyEvents={shouldSubscribeToArrowKeyEvents}
702+
disableKeyboardShortcuts={!shouldSubscribeToArrowKeyEvents}
703+
addBottomSafeAreaPadding
704+
/>
705+
)
704706
);
705707
}
706708

0 commit comments

Comments
 (0)