Consider negative border radii and widths invalid

Reviewed By: achen1

Differential Revision: D5998369

fbshipit-source-id: d54302777f4eeb13f4521800130c17ac07f1b354
This commit is contained in:
Ramanpreet Nara 2017-10-19 17:46:53 -07:00 committed by Facebook Github Bot
parent bae9b2b206
commit 99d294bf3d
1 changed files with 9 additions and 0 deletions

View File

@ -73,6 +73,10 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
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 class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
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);
}