Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix useAnimatedKeyboard when keyboard type changes #5337

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

andreysam
Copy link
Contributor

Summary

FIxes #5208

For some reasons i don't understand, android's WindowInsetsAnimationCompat.Callback don't run any animations when keyboard height changes (maybe because there is no animation 馃). It only works when keyboard opens/closes. I personally had a problem with emoji keyboard. User opens text keyboard, then goes into emoji (same problem in gboard gif/stickers) and keyboard gets bigger, but app doesn't. setOnApplyWindowInsetsListener on the other hand knows about new keyboard's height and in my commit i just send this update without any animation to updateKeyboard.

Test plan

I've tested this on my samsung a71 with android 13 (one ui 5.1). Needs testing on

  1. <11 android without keyboard animation support
  2. other os
  3. other keyboards

@andreysam
Copy link
Contributor Author

Hey @tomekzaw I saw you ran some actions pipeline yesterday, and one failed because of codestyle. I fixed it in latest commit. Can you run this please?

@tomekzaw
Copy link
Member

tomekzaw commented Nov 4, 2023

@andreysam Sure thing! Thanks for submitting this PR, we'll review it soon.

Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! 馃檶

@piaskowyk piaskowyk added this pull request to the merge queue Nov 10, 2023
Merged via the queue into software-mansion:main with commit c8aa6f6 Nov 10, 2023
9 checks passed
Latropos pushed a commit that referenced this pull request Nov 13, 2023
## Summary

FIxes #5208 

For some reasons i don't understand, android's
WindowInsetsAnimationCompat.Callback don't run any animations when
keyboard height changes (maybe because there is no animation 馃). It only
works when keyboard opens/closes. I personally had a problem with emoji
keyboard. User opens text keyboard, then goes into emoji (same problem
in gboard gif/stickers) and keyboard gets bigger, but app doesn't.
setOnApplyWindowInsetsListener on the other hand knows about new
keyboard's height and in my commit i just send this update without any
animation to updateKeyboard.

## Test plan

I've tested this on my samsung a71 with android 13 (one ui 5.1). Needs
testing on
1. <11 android without keyboard animation support
2. other os
3. other keyboards
@taeyoon0137
Copy link

Is this actually fixed? It occurs on ^3.6.2.

Also, this seems not only react-native-reanimated's problem.
Keyboard.metrics().height also returns same value(The First Keyboard Height when first input has been focused)

@andreysam
Copy link
Contributor Author

andreysam commented Apr 23, 2024

Is this actually fixed? It occurs on ^3.6.2.

Also, this seems not only react-native-reanimated's problem. Keyboard.metrics().height also returns same value(The First Keyboard Height when first input has been focused)

I don't have any problems with keyboard height. Maybe there is a problem with your AndroidManifest.xml? My Activity has android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:windowSoftInputMode="adjustResize" and it works great.
If it isn't the case, open a new issue with device info and reproducible demo

@taeyoon0137
Copy link

taeyoon0137 commented Apr 23, 2024

Is this actually fixed? It occurs on ^3.6.2.
Also, this seems not only react-native-reanimated's problem. Keyboard.metrics().height also returns same value(The First Keyboard Height when first input has been focused)

I don't have any problems with keyboard height. Maybe there is a problem with your AndroidManifest.xml? My Activity has android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:windowSoftInputMode="adjustResize" and it works great. If it isn't the case, open a new issue with device info and reproducible demo

Thank you for your quick response!

Upon further examination, I've determined that the issue I am experiencing (although it leads to the same outcome as the issue you posted) is inherent to React-Native. I found that continuously measuring the keyboard height using setInterval and Keyboard.measure() while switching the focused input, Keyboard.measure() consistently returns the keyboard height from the initial focus, even if the keyboard height changes.

Additionally, attempts to receive "keyboardDidChangeFrame" and "keyboardWillChangeFrame" events through Keyboard.addListener() also confirmed that these events do not occur as expected.

I have documented this issue on React-Native's GitHub page: facebook/react-native#44200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants