From 8ed649baae197d413d464e4fe71f4bf2a61b7ad7 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Mon, 27 Nov 2017 17:31:10 -0800 Subject: [PATCH] Fix border-rendering in APIs < 18 cont. Reviewed By: achen1 Differential Revision: D6418192 fbshipit-source-id: 2186a6103d6542f5ced332d5cb083b1f58bfd43d --- .../facebook/react/views/view/ReactViewGroup.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java index 3d7a4299ec0546..e0984f86e09cac 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java @@ -229,7 +229,20 @@ public void setBorderColor(int position, float rgb, float alpha) { } public void setBorderRadius(float borderRadius) { - getOrCreateReactViewBackground().setRadius(borderRadius); + ReactViewBackgroundDrawable backgroundDrawable = getOrCreateReactViewBackground(); + backgroundDrawable.setRadius(borderRadius); + + if (Build.VERSION_CODES.HONEYCOMB < Build.VERSION.SDK_INT + && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + final int UPDATED_LAYER_TYPE = + backgroundDrawable.hasRoundedBorders() + ? View.LAYER_TYPE_SOFTWARE + : View.LAYER_TYPE_HARDWARE; + + if (UPDATED_LAYER_TYPE != getLayerType()) { + setLayerType(UPDATED_LAYER_TYPE, null); + } + } } public void setBorderRadius(float borderRadius, int position) {