Skip to content

Commit 2239609

Browse files
authored
Merge pull request #61358 from abzokhattab/fix-distance-rate-multiselect-v2
2 parents 3ea388f + 57a747a commit 2239609

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/components/SelectionList/BaseSelectionList.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function BaseSelectionList<TItem extends ListItem>(
129129
shouldDebounceScrolling = false,
130130
shouldPreventActiveCellVirtualization = false,
131131
shouldScrollToFocusedIndex = true,
132+
isSmallScreenWidth,
132133
onContentSizeChange,
133134
listItemTitleStyles,
134135
initialNumToRender = 12,
@@ -413,6 +414,11 @@ function BaseSelectionList<TItem extends ListItem>(
413414

414415
if (shouldShowTextInput) {
415416
clearInputAfterSelect();
417+
} else if (isSmallScreenWidth) {
418+
if (!item.isDisabledCheckbox) {
419+
onCheckboxPress?.(item);
420+
}
421+
return;
416422
}
417423
}
418424

@@ -438,6 +444,8 @@ function BaseSelectionList<TItem extends ListItem>(
438444
shouldPreventDefaultFocusOnSelectRow,
439445
isFocused,
440446
isScreenFocused,
447+
isSmallScreenWidth,
448+
onCheckboxPress,
441449
],
442450
);
443451

src/components/SelectionList/types.ts

+3
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ type SelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {
716716
/** Whether to scroll to the focused index */
717717
shouldScrollToFocusedIndex?: boolean;
718718

719+
/** Whether the layout is narrow */
720+
isSmallScreenWidth?: boolean;
721+
719722
/** Called when scrollable content view of the ScrollView changes */
720723
onContentSizeChange?: (w: number, h: number) => void;
721724

src/components/SelectionListWithModal/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function SelectionListWithModal<TItem extends ListItem>(
115115
sections={sections}
116116
onLongPressRow={handleLongPressRow}
117117
isScreenFocused={isScreenFocused}
118+
isSmallScreenWidth={isSmallScreenWidth}
118119
// eslint-disable-next-line react/jsx-props-no-spreading
119120
{...rest}
120121
/>

0 commit comments

Comments
 (0)