Skip to content

Nested buttons press event #44

@flahtorres

Description

@flahtorres

I have a custom component that have to buttons using Ripple, a button act like a container and another to only icon. Both the container and icon have distincts press events, but when I a click in the icon, only the container is trigerted and a the icon press event is never called.

Here is the code

<Ripple onPress={event1}>
    <View>
        <Text>Primary click handler</Text>
        {/* antoher view elemets */}

        <Ripple onPress={event2}>
            <View>
                <Icon />
            </View>
        </Ripple>
    </View>
</Ripple>

When I click in the text, the "event1" is called and I see the ripple in all container.
When I click in the Icon, the"event1" is called too and I see the ripple in all container instead of only in Icon
The "event2" is never called and I never see their ripple

This doesn't happened when I tried to render with react-native TouchableOppacity instead of Ripple

Obs: the Icon element is a implementation of react-native-vector-icons, I tried change the icon to a text and I have the same issue

React-Native: 0.68.2
React-Native-Material-Ripple: 0.9.1
I am testing on Android Studio emulator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions