useAnimatedKeyboard reports wrong values when used with prefersCrossFadeTransitions turned on with iOS.
Prefer Cross-Fade Transitions is a sub option, after turning on Reduce Motion on iOS. It seems when this is turned on, the useAnimatedKeyboard reports wrong info.
Can be reproduced in example app, I tested with apps/paper-example in react-native-reanimated repository.
Install and get running on an iOS simulator as normally.
Go into settings on iOS device and turn on Reduce Motion + Prefer Cross-Fade Transitions
Go into reanimated paper example app, and open useAnimatedKeyboard example.
Tap input field, to get keyboard up. Then tap outside for it to close.
Keyboard focus works, but when hiding keyboard, the animated keyboard reports wrong height and status afterwards, when keyboard is closed.
a. Have experienced some scenarios of it also giving to big a height on opening keyboard.
Then on opening the values seems correct, going to correct height and open state.
But on closing it goes to 0 height, then straight up to a lot higher, with still reporting keyboard as open.
INFO keyboard state 0 0
INFO keyboard state 0 2
INFO keyboard state 291 2
INFO keyboard state 0 2
INFO keyboard state 852 2
Description
useAnimatedKeyboard
reports wrong values when used withprefersCrossFadeTransitions
turned on with iOS. Prefer Cross-Fade Transitions is a sub option, after turning on Reduce Motion on iOS. It seems when this is turned on, theuseAnimatedKeyboard
reports wrong info.A similar issue was fixed in react natives keyboard avoiding view here: https://github.com/facebook/react-native/pull/34503
Steps to reproduce
apps/paper-example
inreact-native-reanimated
repository.https://github.com/user-attachments/assets/aca6932f-60cb-4fbe-ba5b-e3a0f4538673
Logged values
With added logs by usage of animated keyboard:
Then on opening the values seems correct, going to correct height and open state. But on closing it goes to 0 height, then straight up to a lot higher, with still reporting keyboard as open.
Snack or a link to a repository
https://github.com/software-mansion/react-native-reanimated/tree/main/apps/paper-example
Reanimated version
3.15.0
React Native version
0.75.1
Platforms
iOS
JavaScript runtime
None
Workflow
None
Architecture
Paper (Old Architecture)
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes