Skip to content

Commit 13fe49c

Browse files
committed
Make disabled but selected items not muted
1 parent 9864ae8 commit 13fe49c

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/components/SelectionList/BaseSelectionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ function BaseSelectionList<TItem extends ListItem>({
347347
};
348348

349349
const renderItem: ListRenderItem<TItem> = ({item, index}: ListRenderItemInfo<TItem>) => {
350-
const isItemDisabled = isDisabled || item.isDisabled;
351350
const selected = isItemSelected(item);
351+
const isItemDisabled = isDisabled || (!!item.isDisabled && !selected);
352352
const isItemFocused = (!isDisabled || selected) && focusedIndex === index;
353353
const isItemVisuallyFocused = isItemFocused && (shouldHighlightInitiallyFocusedItem || isKeyboardNavigating);
354354
const isItemHighlighted = !!itemsToHighlight?.has(item.keyForList);

src/components/SelectionList/ListItem/SelectableListItem.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ function SelectableListItem<TItem extends ListItem>({
2525
}: SelectableListItemProps<TItem>) {
2626
const styles = useThemeStyles();
2727
const ButtonComponent = canSelectMultiple ? ListCheckbox : ListRadioButton;
28-
const isButtonDisabled = (!!isDisabled && !item.isSelected) || item.isDisabledCheckbox;
29-
const shouldDimButton = !!isDisabled && !!item.isSelected && !item.isDisabledCheckbox;
3028

3129
return (
3230
<BaseListItem
@@ -43,8 +41,8 @@ function SelectableListItem<TItem extends ListItem>({
4341
<ButtonComponent
4442
item={item}
4543
onSelectRow={onSelectionButtonPress ?? onSelectRow}
46-
disabled={isButtonDisabled}
47-
style={[styles.ml3, shouldDimButton && styles.buttonOpacityDisabled]}
44+
disabled={!!isDisabled || !!item.isDisabledCheckbox}
45+
style={styles.ml3}
4846
/>
4947
{typeof rightHandSideComponent === 'function' ? rightHandSideComponent(item, isFocused) : rightHandSideComponent}
5048
</>
@@ -59,8 +57,8 @@ function SelectableListItem<TItem extends ListItem>({
5957
<ButtonComponent
6058
item={item}
6159
onSelectRow={onSelectionButtonPress ?? onSelectRow}
62-
disabled={isButtonDisabled}
63-
style={[styles.mr3, shouldDimButton && styles.buttonOpacityDisabled]}
60+
disabled={!!isDisabled || item.isDisabledCheckbox}
61+
style={styles.mr3}
6462
/>
6563
{typeof children === 'function' ? children(hovered) : children}
6664
</>

src/components/SelectionList/SelectionListWithSections/BaseSelectionListWithSections.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
364364
case CONST.SECTION_LIST_ITEM_TYPE.ROW: {
365365
const isItemFocused = index === focusedIndex;
366366
const isItemVisuallyFocused = isItemFocused && (shouldHighlightInitiallyFocusedItem || isKeyboardNavigating);
367-
const isDisabled = !!item.isDisabled;
367+
const isDisabled = !!item.isDisabled && !item.isSelected;
368368

369369
return (
370370
<ListItemRenderer

0 commit comments

Comments
 (0)