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: google password manager breaks KeyboardAwareScrollView #667

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Oct 29, 2024

📜 Description

Fixed input hiding when google password manager pops up.

💡 Motivation and Context

The native code worked correctly, however when Google Password manager popup appears, then we have next events:

onStart -> 0
onMove -> 289.66
onMove -> 289.44
onEnd -> 0

So because of this fact we kept bottom area (fake view). When keyboard appear again, then we were animating this bottom view again from 0 to 290. But since in the beginning of the keyboard movement focused input was above the keyboard - we don't perform scrollTo operation. But when bottom padding collapses to 0 an then input moves behind the keyboard. And since we don't call scrollTo it keeps its present there.

To fix the problem and don't break the state machine we need to synchronize keyboardFrame (currentKeybaordFrame) in onEnd handler. Thus when popup appears, the input will be moved to bottom. When keyboard appear it'll correctly understand, that the keyboard will overlap the input and thus it will push the input as expected.

Fixes #665

📢 Changelog

JS

  • update currentKeyboardFrame in onEnd handler;
  • create syncKeyboardFrame function.

🤔 How Has This Been Tested?

Tested manually on Pixel 7 Pro API 35.

📸 Screenshots (if appropriate):

Before After
telegram-cloud-document-2-5263016610569936569.mp4
telegram-cloud-document-2-5263016610569936563.mp4

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🤖 android Android specific KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component labels Oct 29, 2024
@kirillzyusko kirillzyusko self-assigned this Oct 29, 2024
Copy link
Contributor

github-actions bot commented Oct 29, 2024

📊 Package size report

Current size Target Size Difference
158818 bytes 158537 bytes 281 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review October 30, 2024 14:16
@kirillzyusko kirillzyusko merged commit 4c327dc into main Oct 30, 2024
13 checks passed
@kirillzyusko kirillzyusko deleted the fix/google-password-manager-breaks-keyboard-aware-scroll-view branch October 30, 2024 14:16
kirillzyusko added a commit that referenced this pull request Nov 26, 2024
…errupted (#704)

## 📜 Description

Fixed broken `KeyboardStickyView` position if keyboard dismissing has
been interrupted (by showing a native sheet, for example).

## 💡 Motivation and Context

This problem was discovered in
bluesky-social/social-app#6739

However I discovered such issue even earlier in
#667
- there I found out that progress can be interrupted (keyboard can start
its movement, but then will be interrupted and will be instantly hidden)
and `onEnd` event will be triggered.

Back to the times I fixed a problem by calling `maybeScroll` in `onEnd`
handler. in this PR I want to do a similar thing - the only difference
is that I want to add `onEnd` event to mapping for Animated/Reanimated
values (`useKeyboardAnimation`/`useReanimatedKeyboardAnimation` hooks).

A proper fix for bluesky-social/social-app#6739

## 📢 Changelog

### Android

- update `SharedValue` for `end` event on Android;
- update `Animated.Value` for `end` event on iOS;

## 🤔 How Has This Been Tested?

Tested on CI.

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
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 KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keyboard hides input after autofill on Android
1 participant