mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-05 16:04:38 +00:00
dont create bitmap with 0 height/width during early render.
when specify background color in react-native even parent view height/width could become zero https://github.com/react-native-community/react-native-svg/issues/823
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user