Buttons(iOS | Android): BorderRadius issue with styled components #2594
Labels
Platform: Android
This issue is specific to Android
Platform: iOS
This issue is specific to iOS
Repro provided
A reproduction with a snack or repo is provided
Description
We're attempting to port all instances of
Pressable
from react-native to RNGH Buttons (e.g., RectButton). We utilize NativeWind (akin to Tailwind) and convert them into styled components as follows:Setting a
borderRadius
is straightforward:This approach works seamlessly for every component. However, it encounters issues with the Buttons exported by RNGH. I've identified the root of the problem: the Buttons incorporate an
Animated.View
as a child within the Button and derive theborderRadius
from the flattened Stylesheet.While passing
borderRadius
via thestyle
prop to theStyledComponent
does work, it complicates the process. You can see the relevant code here:react-native-gesture-handler/src/components/GestureButtons.tsx
Lines 270 to 295 in 2cdcdf6
Ideally, we'd like to pass the child component (turning it into an AnimatedStyledView) and be able to add
tw/className
props to it, without the need to wrap it in an outer view. At present, migration is unfeasible for us because wrapping the RNGH Button with a view disrupts a significant amount of our styling.If I recall correctly, we could modify the children's styles in the past. However, this wouldn't be particularly helpful now, as we need the ability to pass our styled props from Tailwind.
Steps to reproduce
See the Snack
https://snack.expo.dev/@hirbod/rngh-button-nativewind?platform=ios
Works fine on web, but does not work on iOS. On iOS, it does apply the borderRadius correctly for the view with the underlayColor (see the red color) but it fails for the main view.
On Android, it fails completely and doesn't even add a color or anything at all.
Snack or a link to a repository
https://snack.expo.dev/@hirbod/rngh-button-nativewind?&platform=ios
Gesture Handler version
2.9.0
React Native version
0.72.3
Platforms
Android, iOS
JavaScript runtime
None
Workflow
Expo bare workflow
Architecture
Paper (Old Architecture)
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: