[ios, macos] Detect zero edge insets more strictly

Edges shouldn’t be able to cancel out other edges, so a summation is inappropriate here.
This commit is contained in:
Minh Nguyễn
2016-08-18 12:26:32 -07:00
committed by Minh Nguyễn
parent 0a4f0e40ec
commit abc825e19b

View File

@@ -176,7 +176,7 @@ global.describeValue = function (value, property, layerType) {
units = ` ${units}`.replace(/pixel/, 'point');
}
if (property.name.indexOf('padding') !== -1) {
if (value.reduce((a, b) => a + b, 0) === 0) {
if (value[0] === 0 && value[1] === 0 && value[2] === 0 && value[3] === 0) {
return '`NSEdgeInsetsZero` or `UIEdgeInsetsZero`';
}
return `${value[0]}${units} on the top, ${value[3]}${units} on the left, ${value[2]}${units} on the bottom, and ${value[1]}${units} on the right`;