Theme variable `androidRippleColor` is not applied to buttons unless rounded
See original GitHub issueI have gone through these following points
- Check latest documentation: https://docs.nativebase.io/
- Check for existing open/closed issues for a possible duplicate before creating a new issue: https://github.com/GeekyAnts/NativeBase/issues
- Use the latest NativeBase release: https://github.com/GeekyAnts/NativeBase/releases
- Check examples from NativeBase KitchenSink https://github.com/GeekyAnts/NativeBase-KitchenSink
- For discussion purpose make use of NativeBase Slack: http://slack.nativebase.io/
- For queries related to theme, check Theme Variables from Docs and live NativeBase Theme Editor http://nativebase.io/customizer/
Issue Description
node, npm, react-native, react and native-base version, expo version if used, xcode version
node: v10.11.0
npm: 6.4.1
react-native: 0.57.1
native-base: 2.8.1
expo: 31.0.5
xcode: 10.1
Expected behaviour
Modifying androidRippleColor
in native-base-theme/variables/platform.js
affects the color used for the ripple effect in themed <Button>
components on Android.
Actual behaviour
Modifying has no effect unless button is rounded. If the button is not rounded but is transparent, the ripple color is set to be transparent and ignores androidRippleColor
altogether.
Steps to reproduce
- Follow the instructions for Customize here: https://docs.nativebase.io/Customize.html#theaming-nb-headref (eject, wrap root component in
<StyleProvider>
, passplatform
theme) - Modify
native-base-theme/variables/platform.js
such that androidRippleColor is changed to something obvious e.g ‘red’ - Add a
<Button>
component from NativeBase - Tap the button, expect to see customised ripple effect
Is the bug present in both iOS and Android or in any one of them?
Android
Any other additional info which would help us debug the issue quicker.
The code for Button.js reflects the behaviour I’m experiencing:
if the button is rounded: https://github.com/GeekyAnts/NativeBase/blob/e96c997492d898d812243d7f19297189c75af4c0/src/basic/Button.js#L78
apply the ripple color: https://github.com/GeekyAnts/NativeBase/blob/e96c997492d898d812243d7f19297189c75af4c0/src/basic/Button.js#L87
otherwise transparent: https://github.com/GeekyAnts/NativeBase/blob/e96c997492d898d812243d7f19297189c75af4c0/src/basic/Button.js#L103
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
I’m experiencing this issue as well, I solved it by setting the button as rounded and then overriding the borderRadius
Please have the ripple effect on transparent button as TouchableOpacity. It’s like no interaction as it was like a text. I place the transparent button on native base header. Using TouchableOpacity will require me to overwrite the property of the text. I prefer native base button.
“native-base”: “^2.13.12”