Permalink
Browse files

Consider negative border radii and widths invalid

Reviewed By: achen1

Differential Revision: D5998369

fbshipit-source-id: d54302777f4eeb13f4521800130c17ac07f1b354
  • Loading branch information...
RSNara authored and facebook-github-bot committed Oct 20, 2017
1 parent bae9b2b commit 99d294bf3d2be24cb2950e0785bebd645a660771
Showing with 9 additions and 0 deletions.
  1. +9 −0 ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java
@@ -73,6 +73,10 @@ public void setAccessible(ReactViewGroup view, boolean accessible) {
defaultFloat = YogaConstants.UNDEFINED
)
public void setBorderRadius(ReactViewGroup view, int index, float borderRadius) {
if (!YogaConstants.isUndefined(borderRadius) && borderRadius < 0) {
borderRadius = YogaConstants.UNDEFINED;
}
if (!YogaConstants.isUndefined(borderRadius)) {
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
}
@@ -153,9 +157,14 @@ public void setNeedsOffscreenAlphaCompositing(
defaultFloat = YogaConstants.UNDEFINED
)
public void setBorderWidth(ReactViewGroup view, int index, float width) {
if (!YogaConstants.isUndefined(width) && width < 0) {
width = YogaConstants.UNDEFINED;
}
if (!YogaConstants.isUndefined(width)) {
width = PixelUtil.toPixelFromDIP(width);
}
view.setBorderWidth(SPACING_TYPES[index], width);
}

0 comments on commit 99d294b

Please sign in to comment.