Skip to content

Commit 5a6ec84

Browse files
committed
fix: ripple not showing on majority of components
1 parent 2133b89 commit 5a6ec84

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/components/TouchableRipple/TouchableRipple.native.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ const TouchableRipple = (
7373
underlayColor,
7474
});
7575

76-
// A workaround for ripple on Android P is to use useForeground + overflow: 'hidden'
76+
// Use foreground ripple on Android P+ to ensure visibility.
77+
// Background ripple requires the view to have a background drawable,
78+
// which isn't always present. Foreground ripple needs overflow: 'hidden'
79+
// to stay within bounds.
7780
// https://github.com/facebook/react-native/issues/6480
7881
const useForeground =
79-
Platform.OS === 'android' &&
80-
Platform.Version >= ANDROID_VERSION_PIE &&
81-
borderless;
82+
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_PIE;
8283

8384
if (TouchableRipple.supported) {
8485
const androidRipple = rippleEffectEnabled
@@ -94,7 +95,7 @@ const TouchableRipple = (
9495
{...rest}
9596
ref={ref}
9697
disabled={disabled}
97-
style={[borderless && styles.overflowHidden, style]}
98+
style={[useForeground && styles.overflowHidden, style]}
9899
android_ripple={androidRipple}
99100
>
100101
{React.Children.only(children)}

0 commit comments

Comments
 (0)