Chip onPress doesn't work on android device
Current behaviour
Since a recent react native update, when pressing on a <Chip> component, the onPress event is not fired, although the onPressIn and onPressOut events still work
Expected behaviour
The onPress event should fire when pressing a <Chip> component
How to reproduce?
Create a <Chip> component as follows:
<Chip
icon={'information'}
onPress={() => {
console.log('onPressed')
}}
onPressIn={() => {
console.log('press in')
}}
onPressOut={() => {
console.log('press out')
}}
>
Hello
</Chip>
And observe what logs are called when clicking on it
What have you tried so far?
Stripping out any functionality that may affect the onPress so it's just console.logs in the method now
Your Environment
| software | version |
|---|---|
| android | min sdk version 24 (error occurs in multiple devices) |
| react-native | 0.73.6 |
| react-native-paper | 5.12.3 |
| node | 18.20.2 |
| npm or yarn | 3.6.4 |
I am having similar issues also with the Button component on an android device. I don't want to swap every use of the component to onPressIn so an update on this will be helpful
It would be great if you could reproduce the bug on https://snack.expo.dev/
I'm having the same issue within Menu Items wrapped by TouchableRipple, onPress does not work on Android, but onPressIn does work. Issue occurs since upgrading to react-native 0.74 (in combination with New Architecture).
Same issue here - no issues before switching to the New Architecture. It's only occurring some of the time, oddly. Hopefully the Paper team can get this sorted out since React Native is moving faster and faster toward New Architecture/Fabric Bridgeless being the default for RN.
Bugs with runnable code will get more preference and easy to debug the issue
Understood, and I'm planning on making a Snack to replicate this. Just haven't gotten around to it.
Is there any workarounds?
Tested on the latest version - 5.13.3 - the issue is not valid anymore.