Fix drawRect with NaN when drawing borders in Nodes

Summary:
drawRect was sometimes being called with NaN values, which caused
very strange ui behavior on some devices. This patch fixes the problem by
ensuring that we use a default value when the value is NaN.

Reviewed By: AaaChiuuu

Differential Revision: D4338453
This commit is contained in:
Ahmed El-Helw 2016-12-16 11:55:11 -08:00
parent e9dba410eb
commit 761089211f

View File

@ -407,7 +407,7 @@ import com.facebook.react.uimanager.Spacing;
}
private static float resolveWidth(float width, float defaultWidth) {
return width == 0 ? defaultWidth : width;
return (width == 0 || /* check for NaN */ width != width) ? defaultWidth : width;
}
private static DashPathEffect createDashPathEffect(float borderWidth) {