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

Feature. Possibility to disable iOS above keyboard inputAccessoryView #1124

Merged
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
1 change: 1 addition & 0 deletions ios/Classes/InAppWebView/FlutterWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView {
contextMenu: contextMenu,
channel: channel!,
userScripts: userScripts)
webView?.disableInputAccessoryView = options.disableInputAccessoryView
}

methodCallDelegate = InAppWebViewMethodHandler(webView: webView!)
Expand Down
11 changes: 5 additions & 6 deletions ios/Classes/InAppWebView/InAppWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2942,10 +2942,9 @@ if(window.\(JAVASCRIPT_BRIDGE_NAME)[\(_callHandlerID)] != null) {
}

// var accessoryView: UIView?
//
// // https://stackoverflow.com/a/58001395/4637638
// public override var inputAccessoryView: UIView? {
// // remove/replace the default accessory view
// return accessoryView
// }
var disableInputAccessoryView = false
// https://stackoverflow.com/a/58001395/4637638
public override var inputAccessoryView: UIView? {
return disableInputAccessoryView ? nil : super.inputAccessoryView
}
}
1 change: 1 addition & 0 deletions ios/Classes/InAppWebView/InAppWebViewOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class InAppWebViewOptions: Options<InAppWebView> {
var applePayAPIEnabled = false
var allowingReadAccessTo: String? = nil
var disableLongPressContextMenuOnLinks = false
var disableInputAccessoryView = false

override init(){
super.init()
Expand Down
9 changes: 8 additions & 1 deletion lib/src/in_app_webview/ios/in_app_webview_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ class IOSInAppWebViewOptions
///The default value is `false`.
bool disableLongPressContextMenuOnLinks;

///Set to `true` to disable inputAccessoryView above system keyboard
///https://developer.apple.com/documentation/uikit/uiresponder/1621119-inputaccessoryview
bool disableInputAccessoryView;

IOSInAppWebViewOptions(
{this.disallowOverScroll = false,
this.enableViewportScale = false,
Expand Down Expand Up @@ -255,7 +259,8 @@ class IOSInAppWebViewOptions
this.useOnNavigationResponse = false,
this.applePayAPIEnabled = false,
this.allowingReadAccessTo,
this.disableLongPressContextMenuOnLinks = false}) {
this.disableLongPressContextMenuOnLinks = false,
this.disableInputAccessoryView = false}) {
assert(
allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file"));
}
Expand Down Expand Up @@ -303,6 +308,7 @@ class IOSInAppWebViewOptions
"applePayAPIEnabled": applePayAPIEnabled,
"allowingReadAccessTo": allowingReadAccessTo.toString(),
"disableLongPressContextMenuOnLinks": disableLongPressContextMenuOnLinks,
"disableInputAccessoryView": disableInputAccessoryView,
};
}

Expand Down Expand Up @@ -365,6 +371,7 @@ class IOSInAppWebViewOptions
: null;
options.disableLongPressContextMenuOnLinks =
map["disableLongPressContextMenuOnLinks"];
options.disableInputAccessoryView = map["disableInputAccessoryView"];
return options;
}

Expand Down