question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Theme variable `androidRippleColor` is not applied to buttons unless rounded

See original GitHub issue

I have gone through these following points

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

  1. Follow the instructions for Customize here: https://docs.nativebase.io/Customize.html#theaming-nb-headref (eject, wrap root component in <StyleProvider>, pass platform theme)
  2. Modify native-base-theme/variables/platform.js such that androidRippleColor is changed to something obvious e.g ‘red’
  3. Add a <Button> component from NativeBase
  4. 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
appersidecommented, Apr 12, 2019

I’m experiencing this issue as well, I solved it by setting the button as rounded and then overriding the borderRadius

<Button
	rounded
	bordered
	androidRippleColor="red"
	style={{ borderRadius: 5 }} //<-- override border radius with whatever value you want
	onPress={() => {}}>
	<Text>Primary</Text>
</Button>
0reactions
luieycommented, May 28, 2020

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”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Applying buttonStyle as theme doesn't work, but does if ...
If I apply the style to the button directly it works, but if I apply the style to the theme using android:buttonStyle it...
Read more >
Custom CSS for Buttons not updating on Mobile responsive?
So it's only being applied when the screen size is bigger than 1001px. I'm going to get these settings in the admin as...
Read more >
Button - NativeBase
Button : The button component with support for custom icons, spinners, etc. Button.Group : Used to group buttons whose actions are related, with...
Read more >
JavaScript @shoutem/theme connectStyle Examples
These are the top rated real world JavaScript examples of @shoutem/theme.connectStyle extracted from open source projects. You can rate examples to help us ......
Read more >
How to Recreate the Ripple Effect of Material Design Buttons
We can omit from and CSS will construct the missing values based on those that apply to the animated element. This occurs if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found