Skip to content

Commit 9589f64

Browse files
authored
Merge pull request #54962 from daledah/fix/54931
[CP Staging] fix: unable to change currency with arrow key
2 parents cc8fcc3 + 8924bc7 commit 9589f64

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/SelectionList/BaseSelectionList.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,15 @@ function BaseSelectionList<TItem extends ListItem>(
333333
isFocused,
334334
});
335335

336+
const selectedItemIndex = useMemo(() => flattenedSections.allOptions.findIndex((option) => option.isSelected), [flattenedSections.allOptions]);
337+
336338
useEffect(() => {
337-
const selectedItemIndex = flattenedSections.allOptions.findIndex((option) => option.isSelected);
338339
if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
339340
return;
340341
}
341342
setFocusedIndex(selectedItemIndex);
342343
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
343-
}, [flattenedSections]);
344+
}, [selectedItemIndex]);
344345

345346
const clearInputAfterSelect = useCallback(() => {
346347
onChangeText?.('');

0 commit comments

Comments
 (0)