bradmartin / nativescript-advanced-webview

NativeScript plugin for Chrome CustomTabs on Android and SafariViewController on iOS.
Other
60 stars 28 forks source link

Does not work with Angular on iOS #58

Closed Bezlepkin closed 1 year ago

Bezlepkin commented 2 years ago

I tried with NativeScript Plain on an iOS device, everything works! But if I try on NativeScript Angular, it only works on Android 2022-03-17_16-48-36 2022-03-17_16-48-50 .

NativeScript: 8.1.5 @nativescript/core: 8.0.2 @nativescript/angular: 13.0.0 nativescript-advanced-webview: 7.0.1

@bradmartin

codemeall commented 1 year ago

@Bezlepkin did you get to resolve this issue? me too getting the same issue

Silureth commented 1 year ago

Posted the same in the other issue #56:

Hi, Yesterday i faced this problem the solution based on this post is to present SafariViewController from rootView. So the code part in ts (in angular 15, and ns 8.4)

import { AdvancedWebViewOptions, openAdvancedUrl, NSAdvancedWebViewEventEmitter, AdvancedWebviewEvents } from 'nativescript-advanced-webview';
import { getRootView } from '@nativescript/core/application';

....

const opts: AdvancedWebViewOptions = {
      url: "<yourURL>",
      showTitle: true,
      toolbarColor: '#336699',
      toolbarControlsColor: '#fff',
      ios: {
        viewController: getRootView().viewController
      }
bradmartin commented 1 year ago

Version 7.0.2 fixes this - or you can use the example provided by @Silureth on the README