From 69f2796b8cf67ab4caf497a789ae16cd8a46a5a9 Mon Sep 17 00:00:00 2001 From: RyosukeCla Date: Mon, 23 Oct 2023 15:52:40 +0900 Subject: [PATCH] fix webview presenting --- ios/Nativebrik/Classes/component.swift | 13 ++++++++++++- ios/Nativebrik/Classes/root.swift | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ios/Nativebrik/Classes/component.swift b/ios/Nativebrik/Classes/component.swift index 7996546..8d92dbe 100644 --- a/ios/Nativebrik/Classes/component.swift +++ b/ios/Nativebrik/Classes/component.swift @@ -19,7 +19,18 @@ class ModalComponentViewController: UIViewController { return } let safariVC = SFSafariViewController(url: urlObj) - self.presentToTop(safariVC) + if let modal = self.currentModal { + if !isPresenting(presented: self.presentedViewController, vc: modal) { + self.currentModal?.dismiss(animated: false) + self.currentModal = nil + } + } + + if let modal = self.currentModal { + modal.present(safariVC, animated: true) + } else { + self.presentToTop(safariVC) + } } func presentNavigation( diff --git a/ios/Nativebrik/Classes/root.swift b/ios/Nativebrik/Classes/root.swift index e5addcc..6c45f42 100644 --- a/ios/Nativebrik/Classes/root.swift +++ b/ios/Nativebrik/Classes/root.swift @@ -72,6 +72,11 @@ class ModalRootViewController: UIViewController { self.modalViewController?.dismissModal() return } + + if page?.data?.kind == PageKind.WEBVIEW_MODAL { + self.modalViewController?.presentWebview(url: page?.data?.webviewUrl ?? "https://nativebrik.com/intl/en/docs/reference/ios") + return + } let pageView = PageView( page: page,