Skip to content

Commit e2b94b7

Browse files
committed
Fix borderless ripple
1 parent ce1e5a0 commit e2b94b7

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -595,22 +595,26 @@ class RNGestureHandlerButtonViewManager :
595595
// Draw the underlay and ripple between background and children.
596596
// Clip to BackgroundStyleApplicator's padding box so the overlay
597597
// never extends beyond the view's resolved border-radius shape.
598+
// Borderless ripples are intentionally not clipped so they can
599+
// extend beyond the view bounds.
598600
override fun dispatchDraw(canvas: Canvas) {
599-
val hasOverlay = underlayDrawable != null || selectableDrawable != null
600-
if (hasOverlay) {
601+
underlayDrawable?.let {
601602
canvas.save()
602603
BackgroundStyleApplicator.clipToPaddingBox(this, canvas)
603-
}
604-
underlayDrawable?.let {
605604
it.setBounds(0, 0, width, height)
606605
it.draw(canvas)
606+
canvas.restore()
607607
}
608608
selectableDrawable?.let {
609+
if (!useBorderlessDrawable) {
610+
canvas.save()
611+
BackgroundStyleApplicator.clipToPaddingBox(this, canvas)
612+
}
609613
it.setBounds(0, 0, width, height)
610614
it.draw(canvas)
611-
}
612-
if (hasOverlay) {
613-
canvas.restore()
615+
if (!useBorderlessDrawable) {
616+
canvas.restore()
617+
}
614618
}
615619
super.dispatchDraw(canvas)
616620
}

0 commit comments

Comments
 (0)