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.

TouchableRipple effect not working when using non-transparent view inside it on Android

See original GitHub issue

Hey! I’m not sure if this exactly is a bug, but I’ve been trying to crawl through documentation and library source code to figure out the cause without success. At least there is not any mention that this is the expected behavior.

See comments below for further investigation

Current behaviour

Ripple effect does not work when using Surface component. If Surface is commented out from the following code snippet, and Text is the first child element of TouchableRipple, ripple effect works as expected.

Expected behaviour

Ripple effect should work with Surface too.

Code sample

Here is a snack:

https://snack.expo.io/SBjEtFbhc

When creating the Snack, I realized that the Snack is actually working as expected in the web review. However, if you run it on an Android device (tried on my OnePlus 6T with Android 10) it’s not working. So this might actually be issue related to Android.

One funny thing that I also noticed is that if you uncomment the margin thing from the snack, a ripple effect is actually appearing where the margin is but not on the content itself. Weird 😄

What have you tried

Extensive debugging, basically everything that I’ve come up with. It seems that the Surface component is the problem here, but I have no idea why.

Your Environment

software version
ios or android Android 10
react-native 0.62.2
react-native-paper ^3.10.1
node v12.16.2
npm or yarn yarn
expo sdk not used

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

12reactions
Nabeeldev20commented, Mar 19, 2021

Why this is closed. Have the same issue.

4reactions
github-actions[bot]commented, Aug 17, 2020

Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TouchableRipple · React Native Paper
A wrapper for views that should respond to touches. Provides a material "ink ripple" interaction effect for supported platforms (>= Android Lollipop).
Read more >
ripple effect on child views not working - Stack Overflow
ripple works only outside child views. how to achieve ripple to effect whole layout including childviews? ... Set "android:background="?android: ...
Read more >
@vivintsolar-oss/native-vs-touchable - npm package | Snyk
The npm package @vivintsolar-oss/native-vs-touchable was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was ...
Read more >
How to add a Touchable Ripple in react-native - GeeksforGeeks
It enhances the look and feels of the application by showing ripple behavior to user touches. We will use the react-native-paper library for ......
Read more >
bottom tab navigator react native transparent Code Example
elevation: 0, <----to get rid of a shadow problem on Android ... change parent state from child use effect in react js ·...
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