Skip to content

Commit 53ba6f2

Browse files
authored
fix: android svg scale 0 (#2424)
# Summary Fixes #2421, bug introduced in https://github.com/software-mansion/react-native-svg/pull/2403/files#diff-7f8adeb6e7faded1a7ef711b4fa9d2b12d29ff386217e838c4551866afdd8befR286 this line. When bitmap size is less or equal to 0 we want to stop rendering the SVG to avoid Android crash. ## Test Plan Set `transform="scale(0)"` to `Svg` element. ## Compatibility | OS | Implemented | | ------- | :---------: | | Android | ✅ | ## Checklist - [x] I have tested this on a device and a simulator
1 parent ea99e5c commit 53ba6f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

android/src/main/java/com/horcrux/svg/SvgView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ protected void onDetachedFromWindow() {
128128

129129
@Override
130130
protected void onDraw(Canvas canvas) {
131-
if (getParent() instanceof VirtualView) {
131+
if (getParent() instanceof VirtualView || mScaleX <= 0 || mScaleY <= 0) {
132132
return;
133133
}
134134
super.onDraw(canvas);

0 commit comments

Comments
 (0)