ionicons icon indicating copy to clipboard operation
ionicons copied to clipboard

latest ion-icons not working with ionic5 on uiwebview and wkwebview

Open rashmendis opened this issue 4 years ago β€’ 17 comments

I was working on a latest ionic project and tried to get these icons to work but there was no luck. Then I tried the sample ionic app which is getting generated with the cli which has the ion-menu with ion icons. Those are working on the iPad browser but not inside the Webview. Tried the old ionicon:4.6.3 and that works fine.

Screenshot 2020-05-14 at 20 13 26

Environment: Angular 9.0.6 Ionic 5

rashmendis avatar May 14 '20 14:05 rashmendis

I can also confirm this issue. In my case, the icons appear the first time but when I force close the Ionic app and open the app again, they disappear because the SVG does not load in the Shadow Content as shown in the screenshot by @rashmendis

himanshuarya avatar Jun 15 '20 12:06 himanshuarya

Same for me On Jun 15, 2020, 5:45 PM +0530, himanshuarya [email protected], wrote:

I can also confirm this issue. In my case, the icons appear the first time but when I force close the Ionic app and open the app again, they disappear because the SVG does not load in the Shadow Content as shown in the screenshot by @rashmendis β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

rashmendis avatar Jun 15 '20 12:06 rashmendis

Another observation is that even on using a custom SVG, the SVG does not load the second time on force closing the app.

himanshuarya avatar Jun 15 '20 12:06 himanshuarya

Yes. Same for me On Jun 15, 2020, 6:21 PM +0530, himanshuarya [email protected], wrote:

Another observation is that even on using a custom SVG, the SVG does not load the second time on force closing the app. β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

rashmendis avatar Jun 15 '20 14:06 rashmendis

Same issues for me

lhaiscapyba avatar Jul 08 '20 20:07 lhaiscapyba

Same here. Not only with UIWebview, also with WKWebview.

jdpsbh avatar Jul 16 '20 20:07 jdpsbh

@rashmendis how did you used the old ionicon:4.6.3? Did you uninstall the 5.x and install the 4.x?

jdpsbh avatar Jul 19 '20 05:07 jdpsbh

Tried that but since ionicon is a dependency for ionic it will install ionicon5 with ionic 5. So I had to downgrade ionic to ionic4 On Jul 19, 2020, 10:45 AM +0530, jdpsbh [email protected], wrote:

@rashmendis how did you used the old ionicon:4.6.3? Did you uninstall the 5.x and install the 4.x? β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

rashmendis avatar Jul 19 '20 05:07 rashmendis

@brandyscarney is anyone from the Ionic team looking into any of the ion-icon issues? It looks like none of the ion-icon issues haven't been assigned, triaged, or being investigated upon. This issue is one of the major issues in Ion-icon v5 which comes along bundled with Ionic 5. This is a blocker issue that is preventing us to upgrade from Ionic 4 to Ionic 5. Can you please get this issue resolved?

himanshuarya avatar Oct 05 '20 04:10 himanshuarya

Hey @himanshuarya, we hear you. Can you share more information on the issue you're seeing (code sample, screenshots)?

bensperry avatar Oct 07 '20 19:10 bensperry

@rashmendis Would you be able to share the code of the sample ionic app in which you were able to reproduce this issue? @bensperry - @rashmendis had shared a DOM screenshot where there is no content in the icon-inner div in the Shadow Content. Please refer to that screenshot in the first comment.

himanshuarya avatar Oct 08 '20 07:10 himanshuarya

@bensperry Just do a ionic start myApp tabs and create an app with ion-icons. Then have to build the app and run it inside a uiwebview or wkwebview in iPad or an Apple device.

rashmendis avatar Oct 08 '20 08:10 rashmendis

Hey @rashmendis, this is frustrating. We are unable to reproduce the issue on our end.

Basically, we need more info. What are you using to deploy the appβ€”are you using Capacitor or Cordova? Please share the exact steps for us to follow and be as specific as possible. This will greatly help us nail down exactly what might be going wrong more quickly.

bensperry avatar Oct 14 '20 17:10 bensperry

@bensperry Not using both Capacitor or Cordova. What you have to do is create a tab app using ionic start myApp tabs. Then you need to build the app using ionic build --prod. Then You have to create a iOS app with a UIWebView or WKWebView and load the ionic app which we build earlier. App is working directly on iPad Safari app without any issues but not working inside the UIWebView or WKWebView. I was testing it inside a Commercial iOS app so won't be able to share the code. But as you can see in the comments it's a common issue when we run the ionic5 app inside a iOS WebView.

rashmendis avatar Oct 15 '20 04:10 rashmendis

Thanks for the issue. So just using WKWebView or UIWebView is not going to be sufficient to get Ionicons loading. The reason is that when an icon SVG is loaded, it is treated as a local file, and WKWebView has some limitations referencing local files by itself.

The best solution here is to use a small local server to serve the files. The easiest way to do this is to use Capacitor. You can view our Getting Started Guide to quickly integrate Capacitor into your existing app.

Can you try your app with Capacitor and let me know if it resolves the issue?

liamdebeasi avatar Oct 15 '20 18:10 liamdebeasi

I was facing same issue. my issue was solved by changing path in angular.json file Old path: .... "assets": [ { "glob": "/*", "input": "src/assets", "output": "assets" }, { "glob": "/*.svg", "input": "node_modules/ionicons/dist/ionicons/svg", "output": "./svg" } ], ....

new path: .... "assets": [ { "glob": "/*", "input": "src/assets", "output": "assets" }, { "glob": "/*.svg", "input": "node_modules/ionicons/dist/svg", "output": "./svg" } ], ....

Sagar-rr avatar Jan 06 '21 06:01 Sagar-rr

Any news on this? <IonIcon .../> is not shown in WebView ...

fortesp avatar Nov 15 '21 14:11 fortesp

Thanks for the report and apologies for the delay. Does this issue still reproduce using the latest version of Ionicons? If so, is there a sample app I can try?

liamdebeasi avatar Nov 08 '22 20:11 liamdebeasi

Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionicons, please create a new issue and ensure the template is fully filled out.

Thank you for using Ionicons!

ionitron-bot[bot] avatar Nov 22 '22 21:11 ionitron-bot[bot]