-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat(WKWebView): Allow focus without user interaction #540
feat(WKWebView): Allow focus without user interaction #540
Conversation
Hey @ericlewis , thanks for this PR!
Otherwise, I'm fine with this new property. |
iOS Simulator 11.4 seems to work |
iOS Simulator 12.2 works |
iOS Simulator 9.3 works |
@allcontributors[bot] please add @ericlewis for code,doc |
I couldn't determine any contributions to add, did you specify any contributions? |
@allcontributors[bot] please add @ericlewis for code doc |
I've put up a pull request to add @ericlewis! 🎉 |
# [5.8.0](v5.7.2...v5.8.0) (2019-04-29) ### Features * **WKWebView:** Allow focus without user interaction ([#540](#540)) ([455c30e](455c30e))
🎉 This PR is included in version 5.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Same |
…ebview#540) * [iOS] Allow focus without user interaction * Add documentation for keyboardDisplayRequiresUserAction * set keyboardDisplayRequiresUserAction default to true
# [5.8.0](react-native-webview/react-native-webview@v5.7.2...v5.8.0) (2019-04-29) ### Features * **WKWebView:** Allow focus without user interaction ([react-native-webview#540](react-native-webview#540)) ([455c30e](react-native-webview@455c30e))
# [5.8.0](react-native-webview/react-native-webview@v5.7.2...v5.8.0) (2019-04-29) ### Features * **WKWebView:** Allow focus without user interaction ([#540](react-native-webview/react-native-webview#540)) ([455c30e](react-native-webview/react-native-webview@455c30e))
Summary
This is an attempt at solving #278 for iOS. It introduces a new prop called
keyboardDisplayRequiresUserAction
. Setting it tofalse
will allow the WebView to bring up the keyboard on focus events. It works on 9.0-12.2. It works by swizzling WKContentView, with different versions for the 11.3-12.20+ ranges.Testing strategy
Created a new app using react-native init using my modified version, setting
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_text_autofocus
as the source. When set to false, it would autofocus, when set to true it didn't. I also tried combining it withhideKeyboardAccessoryView
which also swizzles, and all combinations worked fine.Please let me know what else needs to be done, such as updating docs? Should I also update the UIWebView version? I don't have a lot of expertise in Android, but am happy to tackle that maybe next.