Skip to content

Fix hover support to web for Drawer.Item component #4435

@ThomasCedrini

Description

@ThomasCedrini

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 #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions