Skip to content

Commit 6fa4198

Browse files
Merge pull request #61311 from thelullabyy/fix/60709-cmd-K-fails-open-chat
Cmd+K Navigation Fails to Open Chat After Desktop Update
2 parents e2c93c4 + 46cf5e8 commit 6fa4198

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/components/Search/SearchAutocompleteList.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {useOnyx} from 'react-native-onyx';
55
import * as Expensicons from '@components/Icon/Expensicons';
66
import {usePersonalDetails} from '@components/OnyxProvider';
77
import {useOptionsList} from '@components/OptionListContextProvider';
8+
import type {AnimatedTextInputRef} from '@components/RNTextInput';
89
import SelectionList from '@components/SelectionList';
910
import type {SearchQueryItem, SearchQueryListItemProps} from '@components/SelectionList/Search/SearchQueryListItem';
1011
import SearchQueryListItem, {isSearchQueryItem} from '@components/SelectionList/Search/SearchQueryListItem';
@@ -76,6 +77,9 @@ type SearchAutocompleteListProps = {
7677

7778
/** Callback to highlight (e.g. scroll to) the first matched item in the list. */
7879
onHighlightFirstItem?: () => void;
80+
81+
/** Ref for textInput */
82+
textInputRef?: React.RefObject<AnimatedTextInputRef>;
7983
};
8084

8185
const defaultListOptions = {
@@ -134,8 +138,9 @@ function SearchAutocompleteList(
134138
onListItemPress,
135139
setTextQuery,
136140
updateAutocompleteSubstitutions,
137-
shouldSubscribeToArrowKeyEvents,
141+
shouldSubscribeToArrowKeyEvents = true,
138142
onHighlightFirstItem,
143+
textInputRef,
139144
}: SearchAutocompleteListProps,
140145
ref: ForwardedRef<SelectionListHandle>,
141146
) {
@@ -582,6 +587,9 @@ function SearchAutocompleteList(
582587
onLayout={() => {
583588
setPerformanceTimersEnd();
584589
setIsInitialRender(false);
590+
if (!!textInputRef?.current && ref && 'current' in ref) {
591+
ref.current?.updateExternalTextInputFocus?.(textInputRef.current.isFocused());
592+
}
585593
}}
586594
showScrollIndicator={!shouldUseNarrowLayout}
587595
sectionTitleStyles={styles.mhn2}

src/components/Search/SearchRouter/SearchRouter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
362362
updateAutocompleteSubstitutions={updateAutocompleteSubstitutions}
363363
onHighlightFirstItem={() => listRef.current?.updateAndScrollToFocusedIndex(1)}
364364
ref={listRef}
365+
textInputRef={textInputRef}
365366
/>
366367
</>
367368
)}

0 commit comments

Comments
 (0)