MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / createNativeView

Method createNativeView

packages/core/ui/web-view/index.ios.ts:181–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179 }
180
181 createNativeView() {
182 const jScript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'initial-scale=1.0'); document.getElementsByTagName('head')[0].appendChild(meta);";
183 const wkUScript = WKUserScript.alloc().initWithSourceInjectionTimeForMainFrameOnly(jScript, WKUserScriptInjectionTime.AtDocumentEnd, true);
184 const wkUController = WKUserContentController.new();
185 wkUController.addUserScript(wkUScript);
186 const configuration = WKWebViewConfiguration.new();
187 if (this.iosAllowInlineMediaPlayback) {
188 configuration.allowsInlineMediaPlayback = true;
189 configuration.allowsPictureInPictureMediaPlayback = true;
190 }
191 configuration.userContentController = wkUController;
192 configuration.preferences.setValueForKey(true, 'allowFileAccessFromFileURLs');
193
194 return new WKWebView({
195 frame: CGRectZero,
196 configuration: configuration,
197 });
198 }
199
200 initNativeView() {
201 super.initNativeView();

Callers

nothing calls this directly

Calls 1

newMethod · 0.45

Tested by

no test coverage detected