Skip to content

Cmd+K Navigation Fails to Open Chat After Desktop Update #61311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {useOnyx} from 'react-native-onyx';
import * as Expensicons from '@components/Icon/Expensicons';
import {usePersonalDetails} from '@components/OnyxProvider';
import {useOptionsList} from '@components/OptionListContextProvider';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import SelectionList from '@components/SelectionList';
import type {SearchQueryItem, SearchQueryListItemProps} from '@components/SelectionList/Search/SearchQueryListItem';
import SearchQueryListItem, {isSearchQueryItem} from '@components/SelectionList/Search/SearchQueryListItem';
Expand Down Expand Up @@ -76,6 +77,9 @@ type SearchAutocompleteListProps = {

/** Callback to highlight (e.g. scroll to) the first matched item in the list. */
onHighlightFirstItem?: () => void;

/** Ref for textInput */
textInputRef?: React.RefObject<AnimatedTextInputRef>;
};

const defaultListOptions = {
Expand Down Expand Up @@ -134,8 +138,9 @@ function SearchAutocompleteList(
onListItemPress,
setTextQuery,
updateAutocompleteSubstitutions,
shouldSubscribeToArrowKeyEvents,
shouldSubscribeToArrowKeyEvents = true,
onHighlightFirstItem,
textInputRef,
}: SearchAutocompleteListProps,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -582,6 +587,9 @@ function SearchAutocompleteList(
onLayout={() => {
setPerformanceTimersEnd();
setIsInitialRender(false);
if (!!textInputRef?.current && ref && 'current' in ref) {
ref.current?.updateExternalTextInputFocus?.(textInputRef.current.isFocused());
}
}}
showScrollIndicator={!shouldUseNarrowLayout}
sectionTitleStyles={styles.mhn2}
Expand Down
1 change: 1 addition & 0 deletions src/components/Search/SearchRouter/SearchRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
updateAutocompleteSubstitutions={updateAutocompleteSubstitutions}
onHighlightFirstItem={() => listRef.current?.updateAndScrollToFocusedIndex(1)}
ref={listRef}
textInputRef={textInputRef}
/>
</>
)}
Expand Down