question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: complex SVG on ion-icon is not displayed on iOS

See original GitHub issue

Bug 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cmer4commented, Jul 16, 2019

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

1reaction
cmer4commented, Jul 16, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found