Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webview fixes #73

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Docs/Notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Notes

## UIRefreshControl + viewport-fit=cover bug

To scale the viewport of a browser to fill the display, you may have set viewport-fit=cover;
`<meta name="viewport" content="viewport-fit=cover">`.

If a view `allowsPullToRefresh` in a turbo-ios native app with `viewport-fit=cover`,
the UIRefreshControl will not be positioned as expected.

You can fix this by conditionally removing `viewport-fit=cover` when loading in a native app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a screenshot for this issue?

We set the viewport to width=device-width,initial-scale=1,maximum-scale=1,viewport-fit=cover and haven't noticed this issue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be confounders at play. Would need to repro on a minimal app. But here are screenshots of our app (deployment target 14.0, running on 15.4.1) where the only difference is the inclusion of viewport-fit=cover:

Without viewport-fit=cover:
IMG_4551

With viewport-fit=cover:
IMG_4550

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh you're right ours does that too, now I look at it. I was always like 🤷 that's high up but whatever.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The best way to get started with Turbo iOS to try out the demo app first to get
- [Path Configuration](Docs/PathConfiguration.md)
- [Migration](Docs/Migration.md)
- [Advanced](Docs/Advanced.md)
- [Notes](Docs/Notes.md)

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion Source/Path Configuration/PathConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

public typealias PathProperties = [String: AnyHashable]

public protocol PathConfigurationDelegate: class {
public protocol PathConfigurationDelegate: AnyObject {
/// Notifies delegate when a path configuration has been updated with new data
func pathConfigurationDidUpdate()
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Visitable/VisitableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ open class VisitableView: UIView {
open func activateWebView(_ webView: WKWebView, forVisitable visitable: Visitable) {
self.webView = webView
self.visitable = visitable
addSubview(webView)
insertSubview(webView, at: 0)
addFillConstraints(for: webView)
installRefreshControl()
showOrHideWebView()
Expand Down Expand Up @@ -67,13 +67,13 @@ open class VisitableView: UIView {
guard let scrollView = webView?.scrollView, allowsPullToRefresh else { return }

#if !targetEnvironment(macCatalyst)
scrollView.addSubview(refreshControl)
scrollView.refreshControl = refreshControl
#endif
}

private func removeRefreshControl() {
refreshControl.endRefreshing()
refreshControl.removeFromSuperview()
webView?.scrollView.refreshControl = nil
}

@objc func refresh(_ sender: AnyObject) {
Expand Down