NativeScript 3.4: WebView on iOS performance is Slow

≡放荡痞女 提交于 2020-01-03 04:54:15

问题


When I open an site in the WebView on NativeScript 3.4 & 4.0 the performance of the JavaScript is slow. Much much slower then normal WKWebView when build in Xcode.

I have also tried the NativeScript playground (play.nativescript.org) and if you place out an WebView an run an some site with JavaScript it also have slow performance.

Please help me


回答1:


Se this: github.

The issue might be related to the JavaScript which is set up to config the site's initial-scale.Just for the test I would suggest opening node_modules/tns-core-modules/ui/web-view/web-view-ios.js and replace var jScript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'initial-scale=1.0'); document.getElementsByTagName('head')[0].appendChild(meta);"; -> var jScript = "" then try to build the project again tns run ios and check if the javascript will be executed slowly again.

This make it work great! Thanks to @tsonevn!



来源:https://stackoverflow.com/questions/49781789/nativescript-3-4-webview-on-ios-performance-is-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!