-
Notifications
You must be signed in to change notification settings - Fork 55
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
SVG is not displayed on Android #24
Comments
@sebastian-man @bradmartin |
Hello @Hesamp! The Android library they are wrapping is very old, not maintained and is missing many features. I am able to see SVG files in our Android app, but the SVG files had to be VERY simple -- for example, no gradients. I had to do a text-compare of my SVG files with those simple examples included with the demo app, and see what was different in the headers. Once I changed them, SVGs started to work. So try using some SVGs that are known to work in your app, and if they work, then it's a complexity issue with the SVGs you are using. That's the best answer I can give you based on the information shared - hope it works for you! :) |
Had the same issue. On iOS works beautifully. On Android... even the nativescript.svg logo file doesn't render. |
I have the opposite on Android everything works beautifully, on iOS it seems the SVG renderer does not cope well with masks, but it seems this is a wider iOS issue. |
Have you managed to find a solution ? I can't render any svg, not even a single line. |
@edernlehyaric I managed to get it all working with this fork:
Need to make sure that the SVGs don't contain any masks because they don't display on iOS. |
@abhayastudios Thanks for the tip, unfortunatly it didn't work for me, on android anyway. |
I found out now that on Android the plugins works fine for me on Android 7+ but not on Android 5 or Android 6 (I didn't test below that). On the older Androids my app gets "stuck" on the screen that contains an SVG (doesn't crash, but doesn't respond at all). Considering the Android plugin is not maintained we will either need to wait until #21 is done or just migrate to bitmaps (which I had hoped to avoid). |
Hi there, I just wanted to let anyone know that the fork below is working on Android (I haven't tested all Android versions nor iOS): |
I've also just tested Brad Martin's version, and that's working for Android (where peoplewareDo's does not), too: https://github.com/bradmartin/nativescript-svg The exeleon fork mentioned above is a fork of Brad's repo, incidentally, but it looks like Brad's committed to his fork more recently. The git history is confusing, so hard to recommend which of the two to prefer. |
Note: While these plugins work, they do not support inline animation. So if you have animation built into your svg file. It will not animate. So it's great for font icons, but not much of anything else unfortunately, and so far it doesn't look like this will ever be supported. For example, I have two circles one bigger than the other that rotate at different speeds (it's a loading spinner). All of the animations are built into the svg file so one doesn't have to do anything outside of it but decide its size, and they do not do anything in nativescript at all... It just sit's there... motionless. I wonder if anyone has solved this yet? |
@triniwiz Are you aware of an SVG plugin for NativeScript that supports animated SVGs (both on iOS and Android)? |
I don’t think so but I have that in my todo for all the canvas related stuff 🙂 |
What I ended up doing was breaking my SVG into pieces, and using CSS to absolutely position everything the way I needed, and then animate it with Keyframes. I am using Nativescript with Vue. So I used AbsoluteLayout for positioning, and then CSS to animate the SVGs. It works, but that does take extra work for sure. :) |
HI ,
I add this plugin at my project , but SVG is not displayed on Android
this plugin Works well on ios.
Not even a demo version
The text was updated successfully, but these errors were encountered: