Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on android after adding style transform #2442

Closed
mzaien opened this issue Sep 7, 2024 · 8 comments
Closed

Crash on android after adding style transform #2442

mzaien opened this issue Sep 7, 2024 · 8 comments

Comments

@mzaien
Copy link

mzaien commented Sep 7, 2024

Description

I have added a style to an svg illustration to flip it on english or LRT

                    transform: [{scaleX: I18nManager.isRTL ? 1 : -1}],

I solved this issue temproraly with adding different style to flip the svg

transform: [
        { rotateY: I18nManager.isRTL ? '0deg' : '180deg' },
      ]

And to be honest I'm not really sure if this is a RNSVG issue or not since there are other packages that got updated to latest e.g expo , react-native , reanimated , ...etc but I had a similar environment to the one in our company's app.

here is the error log that might help

Your app just crashed. See the error below.
java.lang.IllegalArgumentException: width and height must be > 0

Steps to reproduce

  • install the repo
  • do a clean prebuild
  • run yarn android

Snack or a link to a repository

https://github.com/mzaien/rn-expo-75-51-svg-bug

SVG version

15.6.0

React Native version

0.75.2

Platforms

Android

JavaScript runtime

Hermes

Workflow

Expo Dev Client

Architecture

Paper (Old Architecture)

Build type

Debug app & dev bundle

Device

Android emulator

Device model

Pixel 8

Acknowledgements

Yes

@mzaien
Copy link
Author

mzaien commented Sep 7, 2024

Seems it is the same issue that was fixed in #2424

@jakex7 can you confirm?, if so when will it be released?

@bohdanprog
Copy link
Member

Hello @mzaien, I tried to reproduce your issue using your example, but it seems that I don't have the problem you described.

ScaleX: 1
image

ScaleX: -1
image

@bohdanprog bohdanprog added the Close when stale This issue is going to be closed when there is no activity for a while label Sep 11, 2024
@arakovskis
Copy link

This PR: #2424 fixes crash, but applying these changes makes SVG not rendered at all when scaleX: -1 is applied.
RN: 0.75.2 and latest svg library version.

@github-actions github-actions bot removed the Close when stale This issue is going to be closed when there is no activity for a while label Sep 12, 2024
@bohdanprog
Copy link
Member

@arakovskis I ran your app and those environments that you provided.

@bohdanprog
Copy link
Member

bohdanprog commented Sep 13, 2024

@mzaien I ran the example that you provided again here is the screen:
Screenshot 2024-09-13 at 15 46 27

@marklu
Copy link

marklu commented Sep 16, 2024

I've also encountered this issue, with a transform scaleX: -1. My workaround was to wrap the svg in a View with the transform for now.

@jakex7
Copy link
Member

jakex7 commented Sep 17, 2024

Hi, thanks for all the reports. I was able to reproduce the bug and have implemented a fix for this issue in #2452. It will be included in the next release.

@jakex7
Copy link
Member

jakex7 commented Sep 17, 2024

It has been fixed in #2452 and included in the v15.7.1 release. If for some reason the problem has not been solved, feel free to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants