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.

[Android] TouchableNativeFeedback's ripples aren't affected by borderRadius when useForeground is true

See original GitHub issue

Related issue: https://github.com/facebook/react-native/issues/6480 – this was resolved with useForeground={false}, but borderRadius of parent is not respected when useForeground={true}.

Have you read the Bugs section of the Contributing to React Native Guide?

Yup!

Environment

  1. react-native -v: 0.45.1
  2. node -v: 7.9.0
  3. npm -v: 4.6.1
  4. yarn --version (if you use Yarn): 0.24.5

Then, specify:

  1. Target Platform (e.g. iOS, Android): Android
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant): Unrelated

Steps to Reproduce

See the demo / description below.

Expected Behavior

When using TouchableNativeFeedback with useForeground, I expect the ripple to be clipped when there are rounded corners on the parent container. This is how it works if useForeground={false}.

Actual Behavior

The ripple is not clipped when useForeground is enabled and the parent has a borderRadius.

screenshots

Reproducible Demo

https://snack.expo.io/BkLe1uSEZ

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
waquidvpcommented, Dec 29, 2017

There is a work around in React Native v 0.51 and v 0.50/ Expo v 24.0 and v 23.0, you can set overflow: 'hidden' on the parent view of the <TouchableNativeFeedback >. You can see the example here: https://snack.expo.io/H17_STXXz

3reactions
rumaxcommented, Oct 25, 2017

+1 The issue is still actual. Can be reproduced with

“react-native”: “^0.47.1”

Meantime the useForeground={false} works as expected.

And according to the documentation useForeground is :

This is useful if one of your child views has a background of its own, or you're e.g. displaying images, and you don't want the ripple to be covered by them.
Read more comments on GitHub >

github_iconTop Results From Across the Web

TouchableNativeFeedback's ripples aren't affected by ... - GitHub
This is a bit of a problem when creating buttons with borderRadius and TouchableNativeFeedback, and the ripples extend out.
Read more >
TouchableNativeFeedback onLongPress radius not affected
When I perform a longPress, then the borderRadius fix does not have any affect. Border radius during long press · react-native · ripple...
Read more >
TouchableNativeFeedback ripple with borderRadius and ...
For a bug report.
Read more >
TouchableNativeFeedback - React Native
A wrapper for making views respond properly to touches (Android only). On Android this component uses native state drawable to display touch ...
Read more >
React Native Community | Implementing the Android Ripple ...
Implementing the Android Ripple Effect on iOS is a common request I receive. ... TouchableNativeFeedback's ripples aren't ... ripples aren't affected by.
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