-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
[iOS] OverKeyboardView
does not work when the keyboard is not active
#618
Comments
@thespacemanatee thank you for the issue! Can you try to comment out a line in example/ios/Podfile with ccache_enabled, reinstall Pods and try again? The thing is that in my example project everything works (i.e. view is shown even when the keyboard is not visible). I am responding to you from a mobile device, so can't share any links, but if you can provide a reproduction example - it would help a lot. In the example app I tested a scenario that you described and it was working well 🙈 |
@kirillzyusko Thank you for the fast reply! I'll try to find some time this week to create a repro, but something that may be of help is that I am using the Native Stack Navigator from |
I'm also using
I'm attaching to last window if keyboard window is not available:
So yeah, really curious what is preventing this component from being working in your case 👀 |
@kirillzyusko Some good news, I found a more robust solution that works for me. I believe diff --git a/node_modules/react-native-keyboard-controller/ios/extensions/UIWindow.swift b/node_modules/react-native-keyboard-controller/ios/extensions/UIWindow.swift
index ead6e37..b4e1d4d 100644
--- a/node_modules/react-native-keyboard-controller/ios/extensions/UIWindow.swift
+++ b/node_modules/react-native-keyboard-controller/ios/extensions/UIWindow.swift
@@ -38,7 +38,22 @@ public extension UIWindow {
func getTopWindow() -> UIWindow? {
// Return the keyboard window if it's available, otherwise return the last window
@@ -12,9 +12,14 @@ index ead6e37..f61bd5b 100644
+ }
+
+ if #available(iOS 13.0, *) {
+ for scene in UIApplication.shared.connectedScenes {
+ if scene.activationState == .foregroundActive,
+ let windowScene = scene as? UIWindowScene,
+ let keyWindow = windowScene.windows.first(where: { $0.isKeyWindow }) {
+ return keyWindow
+ }
+ }
+ return nil
+ } else {
+ return UIApplication.shared.windows.last { $0.isKeyWindow }
+ } |
Thank you for investigation @thespacemanatee ! Appreciate that! Yeah, your code work well in example project - I left one comment what would be better to change, but overall I'm happy to have these changes 😊 |
@kirillzyusko I left a comment here for posterity. I also wanted to add that it seems |
|
Describe the bug
When I use this component, it works as expected on Android, but on iOS, the children of
OverKeyboardView
are invisible when the keyboard is not active. I know they are rendered because they show up in the element inspector and can be interacted with (buttons are still pressable).I think this happens because
UIRemoteKeyboardWindow
is not available when the keyboard is not active, but I don't think it is expected for the contents to be invisible in such cases. If you look at Telegram, the popover can be opened whether or not the keyboard is active.Code snippet
Repo for reproducing
Please let me know if you need a repro, but I believe it should be fairly easy to reproduce.
To Reproduce
Steps to reproduce the behavior:
I tried my best to run the example ios app but I'm getting this error:
Expected behavior
When the keyboard is active, the children in
OverKeyboardView
should not be invisible.Screenshots
iOS
Android
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: