Skip to content

Commit

Permalink
resolve the highlight bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cretadn22 committed Aug 13, 2024
1 parent a71ed0a commit 48a3dae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,11 @@ function BaseSelectionList<TItem extends ListItem>(

useEffect(() => {
// Avoid changing focus if the textInputValue remains unchanged.
if ((prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) || flattenedSections.allOptions.length === 0) {
if (
(prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) ||
flattenedSections.allOptions.length === 0 ||
shouldUpdateFocusedIndex
) {
return;
}
// Remove the focus if the search input is empty or selected options length is changed (and allOptions length remains the same)
Expand All @@ -559,6 +563,7 @@ function BaseSelectionList<TItem extends ListItem>(
updateAndScrollToFocusedIndex,
prevSelectedOptionsLength,
prevAllOptionsLength,
shouldUpdateFocusedIndex,
]);

useEffect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ function NetSuiteCustomFieldMappingPicker({value, errorText, onInputChange}: Net
}}
ListItem={RadioListItem}
initiallyFocusedOptionKey={value ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG}
shouldSingleExecuteRowSelect
shouldUpdateFocusedIndex
/>
{!!errorText && (
<View style={styles.ph5}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function ChooseSegmentTypeStep({onNext, customSegmentType, setCustomSegmentType}
setSelectedType(selected.value);
setIsError(false);
}}
shouldSingleExecuteRowSelect
shouldUpdateFocusedIndex
showConfirmButton
confirmButtonText={translate('common.next')}
onConfirm={onConfirm}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function WorkspaceEditCardLimitTypePage({route}: WorkspaceEditCardLimitTypePageP
onSelectRow={({value}) => setTypeSelected(value)}
sections={[{data}]}
shouldUpdateFocusedIndex
shouldSingleExecuteRowSelect
isAlternateTextMultilineSupported
initiallyFocusedOptionKey={typeSelected}
/>
Expand Down

0 comments on commit 48a3dae

Please sign in to comment.