Skip to content

Commit ce69b35

Browse files
jasozhfacebook-github-bot
authored andcommitted
Add rounded Pressable example in PressableExample
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] Differential Revision: D123816852
1 parent 0605e8e commit ce69b35

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
@@ -312,6 +312,23 @@ function PressableDisabled() {
312312
);
313313
}
314314

315+
function RoundedPressableExample() {
316+
return (
317+
<View>
318+
<Pressable
319+
android_ripple={{color: 'red', borderless: false}}
320+
style={styles.roundedPressable}>
321+
<Text style={{alignSelf: 'center'}}>Background Ripple</Text>
322+
</Pressable>
323+
<Pressable
324+
android_ripple={{color: 'red', borderless: false, foreground: true}}
325+
style={styles.roundedPressable}>
326+
<Text style={{alignSelf: 'center'}}>Foreground Ripple</Text>
327+
</Pressable>
328+
</View>
329+
);
330+
}
331+
315332
const styles = StyleSheet.create({
316333
row: {
317334
justifyContent: 'center',
@@ -397,6 +414,12 @@ const styles = StyleSheet.create({
397414
height: 100,
398415
width: 100,
399416
},
417+
roundedPressable: {
418+
backgroundColor: '#eee',
419+
borderRadius: 100,
420+
padding: 16,
421+
marginTop: 10,
422+
},
400423
});
401424

402425
const examples = [
@@ -714,6 +737,15 @@ const examples = [
714737
);
715738
},
716739
},
740+
{
741+
title: 'Rounded Pressable with Ripple',
742+
description:
743+
'Ripple should clip to the border radius of the Pressable' as string,
744+
platform: 'android',
745+
render: function (): React.Node {
746+
return <RoundedPressableExample />;
747+
},
748+
},
717749
...PressableExampleFbInternal.examples,
718750
];
719751

0 commit comments

Comments
 (0)