Fix resetting margins and borders on android.

Summary: public

Instead of using 0 as a default we should use UNDEFINED values. That is because setting 0 for left border in case when the property was deleted will interfere with horizontal border (or margin) value. Setting UNDEFINED makes CSSLayout nodes behave correctly in that case.

Reviewed By: andreicoman11

Differential Revision: D2668669

fb-gh-sync-id: 61ce62081583fc39864268333ac8c1409c276cad
This commit is contained in:
Krzysztof Magiera 2015-11-18 07:00:46 -08:00 committed by facebook-github-bot-7
parent dea2199af2
commit 9e670a64fc
1 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ public class LayoutShadowNode extends ReactShadowNode {
ViewProps.MARGIN_RIGHT, ViewProps.MARGIN_RIGHT,
ViewProps.MARGIN_TOP, ViewProps.MARGIN_TOP,
ViewProps.MARGIN_BOTTOM, ViewProps.MARGIN_BOTTOM,
}, defaultFloat = 0f) }, defaultFloat = CSSConstants.UNDEFINED)
public void setMargins(int index, float margin) { public void setMargins(int index, float margin) {
setMargin(ViewProps.PADDING_MARGIN_SPACING_TYPES[index], PixelUtil.toPixelFromDIP(margin)); setMargin(ViewProps.PADDING_MARGIN_SPACING_TYPES[index], PixelUtil.toPixelFromDIP(margin));
} }
@ -119,7 +119,7 @@ public class LayoutShadowNode extends ReactShadowNode {
ViewProps.BORDER_RIGHT_WIDTH, ViewProps.BORDER_RIGHT_WIDTH,
ViewProps.BORDER_TOP_WIDTH, ViewProps.BORDER_TOP_WIDTH,
ViewProps.BORDER_BOTTOM_WIDTH, ViewProps.BORDER_BOTTOM_WIDTH,
}, defaultFloat = 0f) }, defaultFloat = CSSConstants.UNDEFINED)
public void setBorderWidths(int index, float borderWidth) { public void setBorderWidths(int index, float borderWidth) {
setBorder(ViewProps.BORDER_SPACING_TYPES[index], PixelUtil.toPixelFromDIP(borderWidth)); setBorder(ViewProps.BORDER_SPACING_TYPES[index], PixelUtil.toPixelFromDIP(borderWidth));
} }