-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
useAnimatedKeyboard returns wrong height #6727
Comments
This will happen when the keyboard animation takes longer than expected. The keyboard height is estimated during animation here based on the keyboard taking 30 frames, or 0.48 seconds at 60 FPS, to show up. If the keyboard animation takes longer than that, the estimation will return the target height. I see this on an iPad with physical keyboard. When using a physical keyboard, there is a small auto-suggest window docked at the bottom of the screen. When bringing up the on screen keyboard, this docked keyboard hides, then bring up the on screen keyboard. That takes longer than 0.48 seconds, resulting in the same behavior. In your case, I think that the keyboard is still finishing the closing animation when it starts opening again. That takes longer than 0.48 seconds, so you see this bug. |
The interactive dismissal logic would get tripped up if the keyboard was rapidly opened and closed, which can happen if a hardware keyboard is used and the autosuggest dock appears and then disappears when the on screen keyboard is opened. Fixes software-mansion#6727.
I may have accidentally fixed this while working on something else. I cannot reproduce anymore with the above patch applied. |
The interactive dismissal logic would get tripped up if the keyboard was rapidly opened and closed, which can happen if a hardware keyboard is used and the autosuggest dock appears and then disappears when the on screen keyboard is opened. Fixes software-mansion#6727.
The interactive dismissal logic would get tripped up if the keyboard was rapidly opened and closed, which can happen if a hardware keyboard is used and the autosuggest dock appears and then disappears when the on screen keyboard is opened. Fixes software-mansion#6727.
The interactive dismissal logic would get tripped up if the keyboard was rapidly opened and closed, which can happen if a hardware keyboard is used and the autosuggest dock appears and then disappears when the on screen keyboard is opened. Fixes software-mansion#6727.
Description
When using
useAnimatedKeyboard
there are times when theheight
returned by the hook is not right, causing the same "jump" effect asKeyboardAvoidingView
. This is caused by the height changing from 0 tomax
almost instantly (or in few 3-5 steps). Usually it happens when pressing rapidly on components, causing keyboard to open and close frequently. This happens both during opening and during closing. It is happening only on iOS, since on Android I'm not able to reproduce this.It is happening also in a barebone react-native project, just with Reanimated.
Screen.Recording.2024-11-18.at.17.35.30.mp4
Steps to reproduce
I configured a barebone app with just Reanimated and I was able to reproduce it. I'll leave the code of that App.tsx here.
App.tsx code
Snack or a link to a repository
https://snack.expo.dev/mtxg_VNC73hJaIz9hoMG0?platform=ios
Code of App.tsx available also in this issue
Reanimated version
3.16.1
React Native version
0.76.1
Platforms
iOS
JavaScript runtime
None
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
Debug app & production bundle
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: