Describe the bug
When KeyboardController is disabled via setEnabled(false), animated values from useReanimatedKeyboardAnimation stop updating.
If the keyboard has not fully finished closing before the controller is disabled, the hook keeps the last keyboard height value. After enabling the controller again, useReanimatedKeyboardAnimation still returns those stale values even though the keyboard is already fully closed.
This causes the hook state to be out of sync with the real keyboard state.
Code snippet
const keyboardController = useKeyboardController();
keyboardController.setEnabled(false);
I am using useReanimatedKeyboardAnimation, and after disabling the controller, its animated values are no longer updated or reset.
Repo for reproducing
I do not have a reproduction repository yet.
To Reproduce
Steps to reproduce the behavior:
- Use
useReanimatedKeyboardAnimation
- Open the keyboard
- Disable
KeyboardController before the keyboard fully finishes closing:
const keyboardController = useKeyboardController();
keyboardController.setEnabled(false);
- Wait until the keyboard is fully closed
- Enable
KeyboardController again
- Check animated values from
useReanimatedKeyboardAnimation
- Observe that they still contain stale keyboard height / previous values
Expected behavior
When KeyboardController is disabled, animated values inside useReanimatedKeyboardAnimation should be reset, so that after enabling the controller again they are either:
0 when the keyboard is fully closed, or
- the current actual values that reflect the real keyboard position
The hook should not keep stale values from the previous keyboard state.
Screenshots
Not attached.
Smartphone (please complete the following information):
- Desktop OS: macOS
- Device: Google Pixel 8a
- OS: Android
- RN version: 0.81.5
- RN architecture: [old]
- JS engine: Hermes
- Library version: 1.19.1
Additional context
The issue happens specifically when the controller is disabled while the keyboard transition is still in progress. In that case, useReanimatedKeyboardAnimation keeps the last known animated values and does not synchronize them with the actual closed keyboard state after re-enabling the controller.
Describe the bug
When
KeyboardControlleris disabled viasetEnabled(false), animated values fromuseReanimatedKeyboardAnimationstop updating.If the keyboard has not fully finished closing before the controller is disabled, the hook keeps the last keyboard height value. After enabling the controller again,
useReanimatedKeyboardAnimationstill returns those stale values even though the keyboard is already fully closed.This causes the hook state to be out of sync with the real keyboard state.
Code snippet
I am using
useReanimatedKeyboardAnimation, and after disabling the controller, its animated values are no longer updated or reset.Repo for reproducing
I do not have a reproduction repository yet.
To Reproduce
Steps to reproduce the behavior:
useReanimatedKeyboardAnimationKeyboardControllerbefore the keyboard fully finishes closing:KeyboardControlleragainuseReanimatedKeyboardAnimationExpected behavior
When
KeyboardControlleris disabled, animated values insideuseReanimatedKeyboardAnimationshould be reset, so that after enabling the controller again they are either:0when the keyboard is fully closed, orThe hook should not keep stale values from the previous keyboard state.
Screenshots
Not attached.
Smartphone (please complete the following information):
Additional context
The issue happens specifically when the controller is disabled while the keyboard transition is still in progress. In that case,
useReanimatedKeyboardAnimationkeeps the last known animated values and does not synchronize them with the actual closed keyboard state after re-enabling the controller.