Skip to content

Commit 68dc582

Browse files
polovicortinico
andauthored
Fix elevation with border-radius set (facebook#48982) (facebook#49877)
* Fix elevation with border-radius set (facebook#48982) * Update packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt --------- Co-authored-by: Nicola Corti <[email protected]>
1 parent 123bfb8 commit 68dc582

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import android.graphics.drawable.LayerDrawable
1616
import android.os.Build
1717
import com.facebook.react.common.annotations.UnstableReactNativeAPI
1818
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
19+
import com.facebook.react.uimanager.PixelUtil.dpToPx
1920
import com.facebook.react.uimanager.style.BorderInsets
2021
import com.facebook.react.uimanager.style.BorderRadiusStyle
2122

@@ -198,17 +199,17 @@ internal class CompositeBackgroundDrawable(
198199

199200
computedBorderRadius?.let {
200201
pathForOutline.addRoundRect(
201-
RectF(bounds),
202-
floatArrayOf(
203-
it.topLeft.horizontal + (computedBorderInsets?.left ?: 0f),
204-
it.topLeft.vertical + (computedBorderInsets?.top ?: 0f),
205-
it.topRight.horizontal + (computedBorderInsets?.right ?: 0f),
206-
it.topRight.vertical + (computedBorderInsets?.top ?: 0f),
207-
it.bottomRight.horizontal + (computedBorderInsets?.right ?: 0f),
208-
it.bottomRight.vertical + (computedBorderInsets?.bottom ?: 0f),
209-
it.bottomLeft.horizontal + (computedBorderInsets?.left ?: 0f),
210-
it.bottomLeft.vertical) + (computedBorderInsets?.bottom ?: 0f),
211-
Path.Direction.CW)
202+
RectF(bounds),
203+
floatArrayOf(
204+
(it.topLeft.horizontal + (computedBorderInsets?.left ?: 0f)).dpToPx(),
205+
(it.topLeft.vertical + (computedBorderInsets?.top ?: 0f)).dpToPx(),
206+
(it.topRight.horizontal + (computedBorderInsets?.right ?: 0f)).dpToPx(),
207+
(it.topRight.vertical + (computedBorderInsets?.top ?: 0f)).dpToPx(),
208+
(it.bottomRight.horizontal + (computedBorderInsets?.right ?: 0f)).dpToPx(),
209+
(it.bottomRight.vertical + (computedBorderInsets?.bottom ?: 0f)).dpToPx(),
210+
(it.bottomLeft.horizontal + (computedBorderInsets?.left ?: 0f)).dpToPx(),
211+
(it.bottomLeft.vertical + (computedBorderInsets?.bottom ?: 0f)).dpToPx()),
212+
Path.Direction.CW)
212213
}
213214

214215
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {

0 commit comments

Comments
 (0)