Skip to content

Commit

Permalink
Merge pull request #40215 from Krishna2323/krishna2323/issue/39716
Browse files Browse the repository at this point in the history
fix: No hover effect for selected options.
  • Loading branch information
luacmartins authored Apr 16, 2024
2 parents dd9ca88 + 0ce27e1 commit 29eb56e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/SelectionList/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function BaseListItem<TItem extends ListItem>({
children,
isFocused,
onFocus = () => {},
hoverStyle,
}: BaseListItemProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -68,7 +69,7 @@ function BaseListItem<TItem extends ListItem>({
accessibilityLabel={item.text ?? ''}
role={CONST.ROLE.BUTTON}
hoverDimmingValue={1}
hoverStyle={!item.isDisabled && !item.isSelected && styles.hoveredComponentBG}
hoverStyle={[!item.isDisabled && styles.hoveredComponentBG, hoverStyle]}
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined}
nativeID={keyForList ?? ''}
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectionList/TableListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function TableListItem<TItem extends ListItem>({
pendingAction={item.pendingAction}
keyForList={item.keyForList}
onFocus={onFocus}
hoverStyle={item.isSelected && styles.activeComponentBG}
>
{(hovered) => (
<>
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
pendingAction?: PendingAction | null;
FooterComponent?: ReactElement;
children?: ReactElement<ListItemProps<TItem>> | ((hovered: boolean) => ReactElement<ListItemProps<TItem>>);
hoverStyle?: StyleProp<ViewStyle>;
};

type UserListItemProps<TItem extends ListItem> = ListItemProps<TItem> & {
Expand Down

0 comments on commit 29eb56e

Please sign in to comment.