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

SVG is not displayed on Android #24

Open
Hesamp opened this issue Sep 2, 2017 · 15 comments
Open

SVG is not displayed on Android #24

Hesamp opened this issue Sep 2, 2017 · 15 comments

Comments

@Hesamp
Copy link

Hesamp commented Sep 2, 2017

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

@Hesamp
Copy link
Author

Hesamp commented Sep 7, 2017

@sebastian-man @bradmartin
Hi, Please answer this issues

@Hesamp
Copy link
Author

Hesamp commented Sep 11, 2017

@TeamMaestro

@datanotion
Copy link

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! :)

@ghost
Copy link

ghost commented Dec 26, 2017

Had the same issue. On iOS works beautifully. On Android... even the nativescript.svg logo file doesn't render.

@abhayastudios
Copy link

abhayastudios commented Apr 13, 2018

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.

@edernlehyaric
Copy link

Have you managed to find a solution ? I can't render any svg, not even a single line.

@abhayastudios
Copy link

@edernlehyaric I managed to get it all working with this fork:

"@teammaestro/nativescript-svg": "^1.0.1"

Need to make sure that the SVGs don't contain any masks because they don't display on iOS.

@edernlehyaric
Copy link

@abhayastudios Thanks for the tip, unfortunatly it didn't work for me, on android anyway.

@abhayastudios
Copy link

abhayastudios commented Jul 23, 2018

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).

@sebj54
Copy link

sebj54 commented Mar 28, 2019

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):
https://github.com/exeleon/nativescript-svg

@shirakaba
Copy link

shirakaba commented Jul 7, 2019

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.

@eaglejs
Copy link

eaglejs commented Aug 26, 2020

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?

@shirakaba
Copy link

While these plugins work, they do not support inline animation.

@triniwiz Are you aware of an SVG plugin for NativeScript that supports animated SVGs (both on iOS and Android)?

@triniwiz
Copy link

I don’t think so but I have that in my todo for all the canvas related stuff 🙂

@eaglejs
Copy link

eaglejs commented Aug 27, 2020

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. :)

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

9 participants