software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.14k stars 983 forks source link

[Pressable] android_ripple / color doesn't work correctly #3246

Open freeboub opened 2 days ago

freeboub commented 2 days ago

Description

on Pressable android_ripple={color: XXX} doesn't work correctly.

Here are issues:

I checked with default react native Pressable these 3 use cases works fine.

Steps to reproduce

Just define a Pressable with android_ripple={{color}}

<Pressable onPress={() => console.log('onPress')} android_ripple={{color: '#FF0000'}}>
         <Text>'Hello World'</Text>
</Pressable>

Snack or a link to a repository

https://github.com/freeboub/bug-react-native-gesture-handler-android-ripple-color

Gesture Handler version

2.21.2

React Native version

0.76.2

Platforms

Android

JavaScript runtime

Hermes

Workflow

Expo bare workflow

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

Android emulator

Device model

reproduced on all android devices

Acknowledgements

Yes

freeboub commented 20 hours ago

I tried to debug the issue and I have an interesting point, This issue is reproducible only with new architecture enabled. JS side looks good, but setRippleColor on kotlin side is never called

freeboub commented 19 hours ago

Ok, I got the root cause, it looks like processColor should not be called with new architecture: doing this in Pressable.tsx fix the issue: rippleColor={android_ripple?.color ?? defaultRippleColor} But it doesn't work with old architecture 😭