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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore non-keyboard animations #300

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Dec 17, 2023

📜 Description

Check that current animation is a keyboard one. If not, then do not send any events to JS.

💡 Motivation and Context

Since we add generic WindowInsetsAnimationCompat.Callback -> its callbacks (onStart/onProgress/onEnd) can be called even when keyboard is not performing an animation. Thus it's important to filter out which events are keyboard-related and which one are not.

Initially I copied an example from Google samples, but their example code didn't have these checks. I assume it's because they had only one screen and it wasn't possible to run other insets animation.

However in Android documentation in code sample they added a check to filter out non-keyboard animations. So taking all the information from above I decided to add these checks and add early return statements to react only on keyboard animation events.

The similar approach was added in next projects:

📢 Changelog

Android

  • added WindowInsetsAnimationCompat extension (new isKeyboardAnimation field);
  • return from onStart/onProgress/onEnd callbacks if provided animation is not keyboard animation.

🤔 How Has This Been Tested?

Tested on:

  • e2e

📸 Screenshots (if appropriate):

No visual difference 🤷‍♂️

📝 Checklist

  • CI successfully passed

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🤖 android Android specific labels Dec 17, 2023
@kirillzyusko kirillzyusko self-assigned this Dec 17, 2023
Copy link
Contributor

📊 Package size report

Current size Target Size Difference
99386 bytes 99245 bytes 141 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review December 18, 2023 16:26
@kirillzyusko kirillzyusko merged commit 702a669 into main Dec 19, 2023
12 checks passed
@kirillzyusko kirillzyusko deleted the fix/android-ignore-non-keyboard-animations branch December 19, 2023 07:18
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.

1 participant