Skip to content

Button hitSlop is not working, it's being passed to the wrong component #4677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TechWilk opened this issue Apr 16, 2025 · 0 comments
Open

Comments

@TechWilk
Copy link

Current behaviour

I have a button which I want to use the hitslop={} prop to increase it's touchable area. Currently hitslop has no impact on the button, I can only touch within the visibile button.

Currently the prop is being passed to <Surface> rather than <TouchableRipple> within the react-native-paper button implementation.

Expected behaviour

When applying hitslop I should be able to press outside the button and still trigger both the animation and onPress events.

How to reproduce?

<Button
          mode="contained"
          onPress={() => console.log("pressed")}
          hitSlop={300}
>
          Press me
</Button>

Preview

N/A

What have you tried so far?

Correctly passing hitslop to the TouchableRipple within react-native-paper resolves the issue. PR incoming.

Your Environment

software version
ios 18.4
android N/A
react-native 0.77.2
react-native-paper 5.12.5
node 23.3.0
npm or yarn 1.22.22
expo sdk 52.0.46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants