title: Prevent Angular NativeScript WebView from zooming with pinch zoom
body: <p>So I have a Nativescript App using Angular (NG 5.1.1 / Angular 7.x)</p>
  
  <p>I have a view with a webview.</p>
  
  <pre><code>    @ViewChild("myWebView") webViewRef: ElementRef;
  
      &lt;WebView class="webview" #myWebView [src]="myURL"&gt;&lt;/WebView&gt;
  </code></pre>
  
  <p>Inside my webview.component.ts I have this.</p>
  
  <pre><code>ngAfterViewInit(): void {
      const webview: WebView = this.webViewRef.nativeElement;
  
      webview.on(WebView.loadFinishedEvent, (args: LoadEventData) =&gt; {
          this.setIndicatorFalse();
          if (webview.ios) {
              webview.ios.scrollView.delegate = UIScrollViewDelegateZ.new();
              webview.ios.scrollView.minimumZoomScale = 1;
              webview.ios.scrollView.maximumZoomScale = 1;
          }
      });
      webview.on(WebView.loadStartedEvent, (args: LoadEventData) =&gt; {
          if (webview.android) {
              webview.android.getSettings().setBuiltInZoomControls(false);
              webview.android.getSettings().setDisplayZoomControls(false);
          } else {
              // @ts-ignore
              webview.ios.multipleTouchEnabled = false;
              webview.ios.scalesPageToFit = false;
              webview.ios.scrollView.bounces = false;
              webview.ios.scrollView.showsHorizontalScrollIndicator = true;
              webview.ios.scrollView.showsVerticalScrollIndicator = true;
              webview.ios.opaque = false;
              webview.ios.scrollView.allowsInlineMediaPlayback = true;
              webview.ios.scrollView.mediaPlaybackRequiresUserAction = false;
          }
      });
  }
  </code></pre>
  
  <p>As you can see i've tried all sorts of stuff to get this webview to not pinch zoom. </p>
  
  <p>I am overriding my ViewDelegate with</p>
  
  <pre><code>webview.ios.scrollView.delegate = UIScrollViewDelegateZ.new();
  </code></pre>
  
  <p>and that file is here</p>
  
  <pre><code>export class UIScrollViewDelegateZ extends NSObject implements UIScrollViewDelegate {
  
  public static ObjCProtocols = [UIScrollViewDelegate];
  
  static new(): UIScrollViewDelegateZ {
      console.log("here we are");
  
      return &lt;UIScrollViewDelegateZ&gt;super.new();
  }
  
  viewForZoomingInScrollView(scrollView: UIScrollView): UIView {
      console.log("viewForZoomingInScrollView");
  
      return null;
  }
  
  scrollViewDidScroll(scrollView: UIScrollView): void {
      console.log("scrollViewDidZoom");
  
      return null;
  }
  
  scrollViewWillBeginZoomingWithView(scrollView: UIScrollView, view: UIView): void {
      console.log("scrollViewWillBeginZoomingWithView   " + scrollView);
  
      return null;
      }
  }
  </code></pre>
  
  <p>When I load my webview and pinch zoom my console log says this:</p>
  
  <pre><code> CONSOLE LOG file:///app/app/webview/scrollDelegate.js:9:20: here we are
   CONSOLE LOG file:///app/app/webview/scrollDelegate.js:21:20: scrollViewWillBeginZoomingWithView   &lt;WKScrollView: 0x7fb140afe000; baseClass = UIScrollView; frame = (0 0; 375 603); clipsToBounds = YES; gestureRecognizers = &lt;NSArray: 0x600000ab2100&gt;; layer = &lt;CALayer: 0x600000537480&gt;; contentOffset: {0, 0}; contentSize: {375, 1916}; adjustedContentInset: {0, 0, 0, 0}&gt;
   CONSOLE LOG file:///app/app/webview/scrollDelegate.js:17:20: scrollViewDidZoom
  </code></pre>
  
  <p>So I feel like I am close?? but I just can't get it to go?  I thought I was suppose to return null / undefined when trying to pinch zoom? which is what a few other SO answers / the web say to do but nothing is working.</p>
  
  <p>the HTML page also has the correct metatag headers...</p>
  
  <pre><code>  &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui"/&gt;
  </code></pre>
  
  <p>Any help would be appreciated! Thanks!!</p>