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

Ability to set keyboardDisplayRequiresUserAction #139

Merged
merged 1 commit into from
May 18, 2018
Merged

Ability to set keyboardDisplayRequiresUserAction #139

merged 1 commit into from
May 18, 2018

Conversation

craigblagg
Copy link

Issue:
When setting focus on an input that lives inside the webview, the keyboard is not displayed.
UIWebView offers keyboardDisplayRequiresUserAction which allows for this to act as one would expect.

Solution:
Use documented approaches to recreating this for a WKWebView - and expose it to React Native.

package.json Outdated
@@ -70,12 +70,12 @@
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/CRAlpha/react-native-wkwebview.git"
"url": "git+https://github.com/craigblagg/react-native-wkwebview.git"
Copy link

@chitezh chitezh May 13, 2018

Choose a reason for hiding this comment

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

Please, revert this change so it can be merged

@@ -8,12 +8,12 @@ Pod::Spec.new do |s|
s.summary = "React Native WKWebView for iOS"
s.author = "Ruoyu Sun <ruoysun@gmail.com> (https://github.com/insraq)"

s.homepage = "https://github.com/CRAlpha/react-native-wkwebview"
s.homepage = "https://github.com/craigblagg/react-native-wkwebview"
Copy link

@chitezh chitezh May 13, 2018

Choose a reason for hiding this comment

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

these ones too

@craigblagg
Copy link
Author

Have now rebased the branch - dropping the changes for your comments above (had just updated them so could use my branch in our apps).

Copy link

@chitezh chitezh left a comment

Choose a reason for hiding this comment

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

@CRAplha kindly merge this. I can confirm it’s working.

Thanks

@insraq
Copy link
Contributor

insraq commented May 16, 2018

Hmm... It seems that this is done by swizzling a private WkWebview method. Would it be problematic during App Review process?

Also, this component tries to stay as a thin wrapper of the official WkWebview public API and avoid incorporate "hacks" like this. So I am a bit reluctant to merge this unless there is a good reason.

@craigblagg
Copy link
Author

craigblagg commented May 16, 2018 via email

@chitezh
Copy link

chitezh commented May 17, 2018

I can confirm that it’s not problematic during app review.
ionic-team/cordova-plugin-wkwebview-engine#171
https://stackoverflow.com/a/48623286/3297914

But I get your point @insraq, if it was possible(easy) to publish this patch as a separate package, that would have been the best option.

@insraq insraq merged commit e0be212 into CRAlpha:master May 18, 2018
@insraq
Copy link
Contributor

insraq commented May 18, 2018

Since it does not cause any trouble for people who don't use it, I have merged this PR. I guess if WkWebView changed their private method signature again, we need to update this hack. Anyway, it should be on npm@1.20.0.

@craigblagg
Copy link
Author

👍 I'll keep an eye out for any changes in the signature, and update accordingly should they come up

@brandons
Copy link

@craigblagg This solution is not working for me on iOS 11.4. The keyboard behavior does not change when adding the keyboardDisplayRequiresUserAction flag. Further adding the swizzle directly in my AppDelegate has no effect either.

@craigblagg
Copy link
Author

craigblagg commented Sep 1, 2018 via email

@jordoh
Copy link

jordoh commented Jun 3, 2019

@brandons - this may not apply to 11.4, but 12.2+ has a different selector (_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject) swizzled in react-native-webview's implementation: https://github.com/react-native-community/react-native-webview/pull/540/files#diff-cffebd9c9732dc4e4399daaa2f525bebR398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants