Skip to content

Allow nested Pressables to bubble their hover state to parent pressables #1875

Description

@roryabraham

Is your feature request related to a problem? Please describe.
When you have a nested Pressable contained within another Pressable, the hover state of the inner Pressable cannot easily be shared with the parent Pressable. I encountered this problem when trying to make a menu that displays when an element is hovered over.

This code sandbox illustrates the problem I'm having.

Describe a solution you'd like
I understand that this isn't always the desired behavior, so perhaps just adding a boolean prop to the Pressable component such as shouldBubbleHoverState, would do the trick.

Describe alternatives you've considered
A temporary workaround is to use a <TouchableOpacity /> instead of a <Pressable /> for the nested element. This has some limitations, however, and would not allow the nested element to take advantage of hoverability too.

Happy to chat some more if you have ideas, need clarification, or can think of other workarounds in the meantime. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions