Skip to content

[RNKC-054] - detect keyboard size changes #58

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

Merged
merged 8 commits into from
Aug 23, 2022

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Aug 20, 2022

Description

Added onApplyWindowInsets into WindowInsetsAnimationCompat.Callback to detect keyboard size changes.

Motivation and Context

It seems like it's only one option to detect such changes. For me it's a little bit strange, that onProgress/onEnd callback is not called and we need to write additional code to track such cases.

Fixes #54

Changelog

JS

  • changed Events example - show height in all events;

Android

  • fixed a bug with missing height in all keyboardDid* events;
  • detect keyboard size changes;
  • renamed class that implements WindowInsetsAnimationCompat.Callback to KeyboardAnimationCallback;

How Has This Been Tested?

Tested manually on:

  • Xiaomi Redmi Note 5 Pro (Android 9)
  • Pixel 3 (Android 12)

Screenshots (if appropriate):

Before After
image image

Checklist

  • CI successfully passed

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🤖 android Android specific labels Aug 20, 2022
context = mReactContext
)
ViewCompat.setWindowInsetsAnimationCallback(decorView, callback)
ViewCompat.setOnApplyWindowInsetsListener(decorView, callback)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Many libraries may rely on decorView and setup their own handlers (for example react-native-screens when translucent status bar prop is set). So the handler may be overwritten

Maybe we can setup listeners on our view?

@kirillzyusko kirillzyusko force-pushed the bugfix/keyboard-size-changes branch from 6ba4450 to 2823366 Compare August 22, 2022 16:31
@kirillzyusko kirillzyusko merged commit a105cf9 into main Aug 23, 2022
@kirillzyusko kirillzyusko deleted the bugfix/keyboard-size-changes branch August 23, 2022 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Android specific 🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useKeyboardAnimation hook is not respecting to keyboard size changes
1 participant