-
-
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
KeyboardToolbar unusable when used inside RN Modal #588
Comments
@aaamoshd just for a context - it doesn't work on iOS only or both iOS and Android? |
@kirillzyusko for me it does not work on both iOS and Android. Sorry missed that in the report. |
@aaamoshd I'm afraid I need a reproduction repo. I've added a Modal in my code and it works well on iOS: Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-09-18.at.18.22.01.mp4On Android it indeed doesn't work (focus can not be set 🤷♂️ ) Do you have the same problem? |
wow that is one weird behavior. |
hi @kirillzyusko, I got the library working on iOS by adding the Additionally, if we create a screen and set its presentation to 'modal' (instead of using RN Modal), the toolbar works on both iOS and Android. My assumption is that since it's just a screen and not a true Modal, this is why it works. Could the library potentially need something similar to how One more thing I noticed on iOS is that the toolbar doesn't stick perfectly to the top of the keyboard—it sits slightly higher. I suspect it might be a configuration issue on my end, but I'd really appreciate it if you could point me in the right direction. Below is the behavior of the toolbar comparing Android and iOS. iOS Toolbar is slightly higher and is not sticky to the view. Thanks again for your time and for the great work! |
Well, if you can provide a minimal reproduction example - then I'll prioritise this issue over others and will try to fix it ASAP. Without a proper reproduction repository/code I feel like I may do something wrong and just waste time and not reproduce it at all 😔
Yeah, you are right.
Well, if you can discover a focused input (and on Android you can easily do that by setting up a global listener), then you should be able to find sibling elements as well, so I believe there is no need to wrap a
This component should be placed straight behind the bottom corner (where keyboard starts its movement) of the screen, i. e. ignoring safe area insets. On you screen I believe it's placed behind bottom safe area inset. So basically you have two options:
If you can prepare a simple reproduction example and show a case when both iOS and Android doesn't work properly, then I promise I'll try to fix it in nearest time 🙏 I understand that the scenario for reproduction seems to be a very simple, but again, in my case only Android/fabric is reproducible. And I have a gut feeling that even if I may fix a problem on my end it doesn't mean that it'll be fixed for your use case. So the reproduction example is highly appreciated and can significantly reduce a time for fixing this problem! ❤️ P. S.
No, I used |
Hi @kirillzyusko I just tried using #590 on my project but still facing the same issue on android where Also interestingly enough, ran into similar bug as of #387 in android, where once I open a keyboard on a screen and then try to open a Modal it was crashing the app or the modal would make the app unusable. The Modal would be behind the current screen but then the entire app would just freeze. But once the utility function was added to wait for the keyboard close before opening a modal and then wrapped the modal within View fixed the issue for me. |
Well, yeah, that's hat I wrote 😔 :
Well, if I were you I would try to remove components one by one, and replace all wrappers with plain RN components (i. e.
Well, this one is also interesting. I fixed an integration with |
hi @kirillzyusko I think you may have fixed the issue regarding toolbar and android when used inside the modal. Essentially, Screen index:
However, I do not have issues with forms that are directly on the screens and they work without having to use the prop As far for the other issue with opening modal while keyboard is open, I wrote a wrapper component for my modals and set a watcher on the isVisible property. Then on android, I call the utility function mentioned in #387 to close the keyboard before opening the modal. Everything seems to be working fine. |
I see @aaamoshd So to sum it up:
What is the problem? That Modal is not stretched to full window screen? I. e. you see something like: |
Hi @kirillzyusko:
Most of my screens follow a certain layout and one of the component defined in the layout is a Also, looks like for the android even with the #590 fix, we need to dirty the form once (either type in the input or click on a different input once the keyboard opens) for it to allow navigation otherwise it does not focus properly. Once I dirty an input that opened the keyboard I can navigate using the toolbar. any idea as to why its happening? It only happens when using a release build on a physical device, on a simulator it works just fine. Also, looks like it only happens first time you open the app and try using the keyboard.
Yeah, I think thats what's happening, Keyboard would close and I wouldn't even see the modal but I know the component was made visible just the whole screen would freeze and I would have to close out the app. |
As a workaround I tried passing a custom button props as
and it worked out. So, thinking this has to do again with ScrollView and it managing taps. |
Hm, this sounds very interesting! 🤔 May I close this problem (since we figured out, that custom button + #590 fixes the problem) and ask you to open separate issues for other problems (i. e. dirtying fields, incorrect modal layout, and any other but keep all of them separate)? I would be glad to fix them, but don't really want to mix different problems in a single issue, because they become very big and for people who searches for similar issues it'll be hard to read all that information. What do you think? Sorry for a long response - I was sick, so couldn't respond quickly to any issues 😔 |
Describe the bug
When KeyboardToolbar component is used inside a react-native modal the next, prev and done buttons become un-clickable and when clicked just closes the keyboard. No matter of z-index in the button props seem to be doing the trick.
Code snippet
Repo for reproducing
Sorry since this is an internal project, I am unable to provide you with the reproducing repo. However, if you install the package, wrap app with and then open a modal with the component from this library along with KeyboardToolbar the navigation buttons become unusable.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
To be able to click on the toolbar to be able to navigate form fields.
Screenshots
Smartphone (please complete the following information):
Additional context
The library is super awesome. It works on all the other screens apart from when being used inside a Modal.
The text was updated successfully, but these errors were encountered: