Skip to content

Commit

Permalink
Fix border-rendering in APIs < 18 cont.
Browse files Browse the repository at this point in the history
Reviewed By: achen1

Differential Revision: D6418192

fbshipit-source-id: 2186a6103d6542f5ced332d5cb083b1f58bfd43d
  • Loading branch information
RSNara authored and facebook-github-bot committed Nov 28, 2017
1 parent 0bef872 commit ca7fe72
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ca7fe72

Please sign in to comment.