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

added automaticallyAdjustsScrollIndicatorInsets option to ios #228

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion ios/Classes/InAppWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
if (options?.clearCache)! {
clearCache()
}

if #available(iOS 13.0, *) {
scrollView.automaticallyAdjustsScrollIndicatorInsets = (options?.automaticallyAdjustsScrollIndicatorInsets)!
}
}

@available(iOS 10.0, *)
Expand Down Expand Up @@ -1239,7 +1243,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi

if error != nil {
let userInfo = (error! as NSError).userInfo
self.onConsoleMessage(message: userInfo["WKJavaScriptExceptionMessage"] as! String, messageLevel: 3)
self.onConsoleMessage(message: userInfo["WKJavaScriptExceptionMessage"] as? String ?? "", messageLevel: 3)
}

if value == nil {
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/InAppWebViewOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class InAppWebViewOptions: Options {
var dataDetectorTypes: [String] = ["NONE"] // WKDataDetectorTypeNone
var preferredContentMode = 0
var sharedCookiesEnabled = false
var automaticallyAdjustsScrollIndicatorInsets = true

override init(){
super.init()
Expand Down
13 changes: 11 additions & 2 deletions lib/src/webview_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@ class IosInAppWebViewOptions
///**NOTE**: available on iOS 11.0+.
bool sharedCookiesEnabled;

///Set `false` if scrollView of WKWebView should not automatically adjust scroll indicator insets.
///The default value is `true`.
///
///**NOTE**: available on iOS 13.0+.
bool automaticallyAdjustsScrollIndicatorInsets;

IosInAppWebViewOptions(
{this.disallowOverScroll = false,
this.enableViewportScale = false,
Expand All @@ -619,7 +625,8 @@ class IosInAppWebViewOptions
this.isFraudulentWebsiteWarningEnabled = true,
this.selectionGranularity = IosInAppWebViewSelectionGranularity.DYNAMIC,
this.dataDetectorTypes = const [IosInAppWebViewDataDetectorTypes.NONE],
this.sharedCookiesEnabled = false});
this.sharedCookiesEnabled = false,
this.automaticallyAdjustsScrollIndicatorInsets = true});

@override
Map<String, dynamic> toMap() {
Expand All @@ -643,7 +650,9 @@ class IosInAppWebViewOptions
"isFraudulentWebsiteWarningEnabled": isFraudulentWebsiteWarningEnabled,
"selectionGranularity": selectionGranularity.toValue(),
"dataDetectorTypes": dataDetectorTypesList,
"sharedCookiesEnabled": sharedCookiesEnabled
"sharedCookiesEnabled": sharedCookiesEnabled,
"automaticallyAdjustsScrollIndicatorInsets":
automaticallyAdjustsScrollIndicatorInsets
};
}

Expand Down