-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Crash on Interactive Keyboard [Android only] #203
Comments
Thanks @ImBeCiliC for reporting the problem! I'll have a look and will try to reproduce/fix the problem! |
@kirillzyusko thanks for the detailed clarification. It is now working for me 🎉 Could be really helpful to others to have this section in the documentation. |
@ImBeCiliC actually I already wrote about this https://kirillzyusko.github.io/react-native-keyboard-controller/docs/guides/building-own-hook Maybe it can be somehow improved? What do you think I should add to be sure that people are aware about this? |
Hi @kirillzyusko ! First of all - huge thx for this lib.
|
the structure of every screen is
|
Hello @4yki 👋 It's hard to say what is going wrong here because input information is limited. May I kindly ask you to create a new issue and provide a minimal reproduction example? |
## 📜 Description Removed `isLaidOut` check from `copyBoundsInWindow` method. ## 💡 Motivation and Context When we are using `native-stack` then on initial mount the view property `isLaidOut` will be `true`. When we open a new screen and return back to the previous `isLaidOut` will be `false`. I've tried to call `invalidate`/`requestLayout`/`forceLayout` methods in `onAttachedToWindow` method, but it doesn't seem to have any effect at all. The I decided to compare how `copyBoundsInWindow` works if `isLaidOut` check is removed. And turned out there is no difference between two executions: |Screen opened first time (isLaidOut check present)|Returned to the screen (isLaidOut is missing to go to if-statement)| |---------------------------------------------------|------------------------------------------------------------------| |<img width="709" alt="Screenshot 2023-11-16 at 17 31 24" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/8f79bfae-3ed8-4e2c-abb6-a8d6a07eab28">|<img width="696" alt="Screenshot 2023-11-16 at 17 52 55" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/4523be4d-36e7-4733-a71f-de7ff0dc5bd1">| So taking this information into consideration I've decided to remove that check. Also for the sake of safety and avoidance of unexpected crashes I decided to remove `throw Exception` construction and replace it with a simple logger (since I'm not handling exceptions in my code it's better to log it). Closes #274 #203 ## 📢 Changelog ### Android - removed `isLaidOut` check from `copyBoundsInWindow` method; - replaced throwing error to logger. ## 🤔 How Has This Been Tested? Tested on Pixel 7 Pro (android 14). ## 📸 Screenshots (if appropriate): https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/ef8661da-8a78-4d4a-9362-668365736fed ## 📝 Checklist - [x] CI successfully passed
@4yki I could reproduce this crash using native-stack navigator. I fixed a problem and published a new |
It seems like it is still crashing on Android. I am wrapping the
|
@Karthik-B-06 please, open a new issue and provide minimal reproduction example 🙏 Basically it can not crash with this exception anymore, because I removed |
Describe the bug
Hard crash with this error been thrown
react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/extensions/View.kt
Line 47 in 756be07
Reproduction is possible in your example repo.
Upon routing into a deeper stack. Home -> Chat with Keyboard Handler -> Forward Friend --- Back Button ---> Chat with Keyboard Handler -> Open Keyboard -> Full Android Crash
Repo for reproducing
https://github.com/ImBeCiliC/keyboard-controller-crash-1
To Reproduce
Steps to reproduce the behavior:
Smartphone (please complete the following information):
Additional context
In the Example the height of the fake view is strange after back navigation
Removing the KeyboardGestureArea removes the crash. Also in my example repo so you can check it out.
Appreciate the nice library and helped improve the React Native Keyboard issues we had in the past 🎉
The text was updated successfully, but these errors were encountered: