bug: complex SVG on ion-icon is not displayed on iOS
See original GitHub issueBug Report
Ionic version: [x] 4.6
Current behavior:
When you use a custom SVG for ion-icon
and this SVG is a little more complex than usual, it does not appear in Safari / iOS. The same SVG works fine on both Safari and Chrome if you use it as background-image
CSS property of an element.
Expected behavior: It should appear correctly on both Safari and Chrome.
Steps to reproduce:
- Clone project below
- Run
npm install
- Run
ionic serve
- Open both Safari and Chrome
Related code: https://github.com/anagstef/ion-icon-safari-bug
Ionic info:
Ionic:
Ionic CLI : 5.2.1 (/Users/anagstef/.nvm/versions/node/v10.15.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.6.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Utility:
cordova-res : not installed
native-run : 0.2.7
System:
NodeJS : v10.15.3 (/Users/anagstef/.nvm/versions/node/v10.15.3/bin/node)
npm : 6.10.0
OS : macOS Mojave
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
bug: complex SVG on ion-icon is not displayed on iOS · Issue ...
When you use a custom SVG for ion-icon and this SVG is a little more complex than usual, it does not appear in...
Read more >iOS does not render SVG images in Ionic 3 project
I get Cannot read property 'svg' of undefined and also it gives error on . · do I need to do something on...
Read more >Problem with SVG on some iPad and iPhone models
I'm having problems with the display of an SVG file on (only) some iPad models and, on iPhone, only on the latest iPhone...
Read more >IonIcons not Showing on Android/IOS Device in ... - YouTube
Ionicons not showing in ionic react 4 application. ionicons svg not loading. ionicons issue solved in this video by installing a cordova ...
Read more >Resources for SVGs - Claris Community - FileMaker Pro
I've spent a good amount of time in the site and have yet to not find at least ... using the iOS icons...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Cool:)
So the thing that caused this effect is still baseUrl related, but not really Ionic specific. See here more details: https://stackoverflow.com/questions/18259032/using-base-tag-on-a-page-that-contains-svg-marker-elements-fails-to-render-marke
I think ion-icon documentation around “custom” svg can be improved though, but other than that there is nothing Ionic can do to improve it
@anagstef can you try the following:
modify “fill” property inside your rocket.svg to feature full absolute url:
instead of fill=‘url(#linearGradient-1)’ do fill=‘url(http://localhost:8100#linearGradient-1)’
This is just for triage. But I am pretty positive this is the issue with Safari not being able to find filters or gradients by relative urls.