From d7d4131f9fa78c40f4f1c1ee3a438a44fa903c12 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 17 Feb 2022 20:41:10 -0800 Subject: [PATCH 1/3] Set the scroll indicator offsets on the webview This prevents the scroll from bouncing when we scroll to the top we should figure out how to query for the system navigation bar size and use that instead of hard coding 50. --- apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift b/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift index 0176a7dd7..e026a046f 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift @@ -35,6 +35,7 @@ import WebKit webView.backgroundColor = UIColor.clear webView.configuration.userContentController = contentController webView.scrollView.delegate = context.coordinator + webView.scrollView.scrollIndicatorInsets = UIEdgeInsets(top: 50, left: 0, bottom: 0, right: 0) for action in WebViewAction.allCases { webView.configuration.userContentController.add(context.coordinator, name: action.rawValue) From e757dbfe6864e1628abc2ae0d215e2bfa5ffeb74 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 17 Feb 2022 21:22:19 -0800 Subject: [PATCH 2/3] Use navBarHeight for the ... nav bar height --- apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift b/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift index e026a046f..e65cda9ff 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift @@ -29,13 +29,13 @@ import WebKit let webView = WebView(frame: CGRect.zero) let contentController = WKUserContentController() - webView.scrollView.contentInset.top = LinkItemDetailView.navBarHeight webView.navigationDelegate = context.coordinator webView.isOpaque = false webView.backgroundColor = UIColor.clear webView.configuration.userContentController = contentController webView.scrollView.delegate = context.coordinator - webView.scrollView.scrollIndicatorInsets = UIEdgeInsets(top: 50, left: 0, bottom: 0, right: 0) + webView.scrollView.contentInset.top = LinkItemDetailView.navBarHeight + webView.scrollView.scrollIndicatorInsets = UIEdgeInsets(top: LinkItemDetailView.navBarHeight, left: 0, bottom: 0, right: 0) for action in WebViewAction.allCases { webView.configuration.userContentController.add(context.coordinator, name: action.rawValue) From 8d743617cb8fa321ffb973031cb067a503b10ef9 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 17 Feb 2022 21:55:22 -0800 Subject: [PATCH 3/3] Use the new verticalScrollIndicatorInsets instead of scrollIndicatorInsets --- apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift b/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift index e65cda9ff..261ed3604 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/WebAppView.swift @@ -35,7 +35,7 @@ import WebKit webView.configuration.userContentController = contentController webView.scrollView.delegate = context.coordinator webView.scrollView.contentInset.top = LinkItemDetailView.navBarHeight - webView.scrollView.scrollIndicatorInsets = UIEdgeInsets(top: LinkItemDetailView.navBarHeight, left: 0, bottom: 0, right: 0) + webView.scrollView.verticalScrollIndicatorInsets = UIEdgeInsets(top: LinkItemDetailView.navBarHeight, left: 0, bottom: 0, right: 0) for action in WebViewAction.allCases { webView.configuration.userContentController.add(context.coordinator, name: action.rawValue)