Skip to content

Commit 2f7b675

Browse files
committed
fix: clip preview ripple to rounded corners
The previous change put borderRadius + overflow on a child inside TouchableNativeFeedback and used the default ripple, which doesn't clip (the default selectableItemBackground ignores the rounded outline). Move the borderRadius + overflow onto a parent that wraps the touchable and use an explicit bounded Ripple so the preview ripple actually rounds, matching the on-device result.
1 parent bbd170e commit 2f7b675

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

src/api/WidgetPreview.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,30 @@ function ClickableAreaButton({
267267
height: area.height,
268268
}}
269269
>
270-
<TouchableNativeFeedback onPress={() => onClick(area)}>
271-
<View
272-
style={{
273-
width: '100%',
274-
height: '100%',
275-
borderColor: 'red',
276-
borderWidth: highlightClickableAreas ? 1 : 0,
277-
borderRadius: area.borderRadius,
278-
overflow: 'hidden',
279-
}}
280-
/>
281-
</TouchableNativeFeedback>
270+
{/* Clip the ripple to the corners: borderRadius + overflow must WRAP the touchable (not sit on
271+
its child), with an explicit bounded Ripple — the default background won't clip (RN #25342). */}
272+
<View
273+
style={{
274+
width: '100%',
275+
height: '100%',
276+
borderRadius: area.borderRadius,
277+
overflow: 'hidden',
278+
}}
279+
>
280+
<TouchableNativeFeedback
281+
onPress={() => onClick(area)}
282+
background={TouchableNativeFeedback.Ripple('rgba(150, 150, 150, 0.35)', false)}
283+
>
284+
<View
285+
style={{
286+
width: '100%',
287+
height: '100%',
288+
borderColor: 'red',
289+
borderWidth: highlightClickableAreas ? 1 : 0,
290+
}}
291+
/>
292+
</TouchableNativeFeedback>
293+
</View>
282294
{highlightClickableAreas ? <ClickableAreaBorder /> : null}
283295
</View>
284296
);

0 commit comments

Comments
 (0)