From ea204a0536f80efeed4113ff1a1690c817932665 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Sat, 3 May 2025 15:41:52 +0200 Subject: [PATCH] Fix workspace features multiselect --- src/components/SelectionList/BaseSelectionList.tsx | 8 ++++++++ src/components/SelectionList/types.ts | 3 +++ src/components/SelectionListWithModal/index.tsx | 1 + 3 files changed, 12 insertions(+) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index c516762fc044..64c7c6174402 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -129,6 +129,7 @@ function BaseSelectionList( shouldDebounceScrolling = false, shouldPreventActiveCellVirtualization = false, shouldScrollToFocusedIndex = true, + isSmallScreenWidth, onContentSizeChange, listItemTitleStyles, initialNumToRender = 12, @@ -412,6 +413,11 @@ function BaseSelectionList( if (shouldShowTextInput) { clearInputAfterSelect(); + } else if (isSmallScreenWidth) { + if (!item.isDisabledCheckbox) { + onCheckboxPress?.(item); + } + return; } } @@ -437,6 +443,8 @@ function BaseSelectionList( shouldPreventDefaultFocusOnSelectRow, isFocused, isScreenFocused, + isSmallScreenWidth, + onCheckboxPress, ], ); diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 9fac2f657f9b..249b927e5c7f 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -666,6 +666,9 @@ type SelectionListProps = Partial & { /** Whether to scroll to the focused index */ shouldScrollToFocusedIndex?: boolean; + /** Whether the layout is narrow */ + isSmallScreenWidth?: boolean; + /** Called when scrollable content view of the ScrollView changes */ onContentSizeChange?: (w: number, h: number) => void; diff --git a/src/components/SelectionListWithModal/index.tsx b/src/components/SelectionListWithModal/index.tsx index 6057e89aa87f..d4f7bfafa7c1 100644 --- a/src/components/SelectionListWithModal/index.tsx +++ b/src/components/SelectionListWithModal/index.tsx @@ -106,6 +106,7 @@ function SelectionListWithModal( sections={sections} onLongPressRow={handleLongPressRow} isScreenFocused={isScreenFocused} + isSmallScreenWidth={isSmallScreenWidth} // eslint-disable-next-line react/jsx-props-no-spreading {...rest} />