react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

Fix hover support to web for Drawer.Item component

Open ThomasCedrini opened this issue 1 year ago • 2 comments

Current behaviour

The Drawer.Item component does not render the hover state in web applications.

Expected behaviour

Render a hover state as it was added in this PR https://github.com/callstack/react-native-paper/pull/3909 for the Drawer.Item component

How to reproduce?

Code example https://snack.expo.dev/@maasto/drawer-item-hover-repro

Preview

In the screenshot below, the pointer is on the second item and the background does not darken as expected. image

What have you tried so far?

The component uses the TouchableRipple component, which behaves as expected for the hover state. However, it overrides the `backgroundColor' style property:

  const backgroundColor = active
    ? isV3
      ? theme.colors.secondaryContainer
      : color(theme.colors.primary).alpha(0.12).rgb().string()
    : 'transparent';

When I remove this backgroundColor from the style props in local, it works as expected.

Your Environment

software version
react-native 0.73.2
react-native-paper 5.12.3
expo sdk 50.0.3

ThomasCedrini avatar Jun 17 '24 12:06 ThomasCedrini

Hey @ThomasCedrini, I've created pull request #4440 with the fix.

seb-zabielski avatar Jun 21 '24 07:06 seb-zabielski

Hey @seb-zabielski ,

Thanks for the PR ! Nice though of passing backgroundColor from transparent to undefined

ThomasCedrini avatar Jun 24 '24 16:06 ThomasCedrini