Merge pull request #824 from netmaxt3r/master

Do not create bitmap with 0 height/width during early render.
This commit is contained in:
Mikael Sand
2018-10-24 23:49:52 +03:00
committed by GitHub
@@ -88,7 +88,8 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
if (mBitmap == null) {
mBitmap = drawOutput();
}
canvas.drawBitmap(mBitmap, 0, 0, null);
if (mBitmap != null)
canvas.drawBitmap(mBitmap, 0, 0, null);
}
@Override
@@ -214,6 +215,9 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
height = (float) PropHelper.fromRelative(mbbHeight, parentHeight, 0, mScale, 12);
setMeasuredDimension((int)Math.ceil(width), (int)Math.ceil(height));
}
if (width == 0 || height == 0) {
return null;
}
Bitmap bitmap = Bitmap.createBitmap(
(int) width,
(int) height,