mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-09 09:27:20 +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) {
|
if (mBitmap == null) {
|
||||||
mBitmap = drawOutput();
|
mBitmap = drawOutput();
|
||||||
}
|
}
|
||||||
canvas.drawBitmap(mBitmap, 0, 0, null);
|
if (mBitmap != null)
|
||||||
|
canvas.drawBitmap(mBitmap, 0, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -214,6 +215,9 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
|
|||||||
height = (float) PropHelper.fromRelative(mbbHeight, parentHeight, 0, mScale, 12);
|
height = (float) PropHelper.fromRelative(mbbHeight, parentHeight, 0, mScale, 12);
|
||||||
setMeasuredDimension((int)Math.ceil(width), (int)Math.ceil(height));
|
setMeasuredDimension((int)Math.ceil(width), (int)Math.ceil(height));
|
||||||
}
|
}
|
||||||
|
if (width == 0 || height == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Bitmap bitmap = Bitmap.createBitmap(
|
Bitmap bitmap = Bitmap.createBitmap(
|
||||||
(int) width,
|
(int) width,
|
||||||
(int) height,
|
(int) height,
|
||||||
|
|||||||
Reference in New Issue
Block a user