Skip to content

Commit 1bf84ce

Browse files
jasozhfacebook-github-bot
authored andcommitted
Add rounded Pressable example in PressableExample (#58938)
Summary: Add a new RNTester example in PressableExample that reproduces the issue where ripple effects don't clip to the Pressable's border radius. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D123816852
1 parent 200245e commit 1bf84ce

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎packages/rn-tester/js/examples/Pressable/PressableExample.js‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,23 @@ function PressableDisabled() {
316316
);
317317
}
318318

319+
function RoundedPressableExample() {
320+
return (
321+
<View>
322+
<Pressable
323+
android_ripple={{color: 'red', borderless: false}}
324+
style={styles.roundedPressable}>
325+
<Text style={{alignSelf: 'center'}}>Background Ripple</Text>
326+
</Pressable>
327+
<Pressable
328+
android_ripple={{color: 'red', borderless: false, foreground: true}}
329+
style={styles.roundedPressable}>
330+
<Text style={{alignSelf: 'center'}}>Foreground Ripple</Text>
331+
</Pressable>
332+
</View>
333+
);
334+
}
335+
319336
const styles = StyleSheet.create({
320337
row: {
321338
justifyContent: 'center',
@@ -401,6 +418,12 @@ const styles = StyleSheet.create({
401418
height: 100,
402419
width: 100,
403420
},
421+
roundedPressable: {
422+
backgroundColor: '#eee',
423+
borderRadius: 100,
424+
padding: 16,
425+
marginTop: 10,
426+
},
404427
});
405428

406429
const examples = [
@@ -718,6 +741,15 @@ const examples = [
718741
);
719742
},
720743
},
744+
{
745+
title: 'Rounded Pressable with Ripple',
746+
description:
747+
'Ripple should clip to the border radius of the Pressable' as string,
748+
platform: 'android',
749+
render: function (): React.Node {
750+
return <RoundedPressableExample />;
751+
},
752+
},
721753
...PressableExampleFbInternal.examples,
722754
];
723755

0 commit comments

Comments
 (0)