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 Android keyboard bug when opening a sheet #6739

Merged
merged 2 commits into from
Nov 26, 2024
Merged

Conversation

mozzius
Copy link
Member

@mozzius mozzius commented Nov 26, 2024

On Android, opening a menu in DMs would cause the keyboard input to enter a strange state. This attempts to fix it by setting the keyboard height on the onEnd event and reimplementing KeyboardStickyView manually (turns out it's a very simple component, and we basically are already doing same the logic anyway for the scrollview)

Before

Screen.Recording.2024-11-26.at.00.17.09.mov

After

Screen.Recording.2024-11-26.at.00.18.39.mov

@mozzius mozzius changed the title Fix keyboard bug when opening a sheet Fix Android keyboard bug when opening a sheet Nov 26, 2024
@gaearon
Copy link
Collaborator

gaearon commented Nov 26, 2024

what’s the bug upstream? is there something we can contribute?

@kirillzyusko
Copy link
Contributor

@mozzius thanks! I prepared a fix in repository: kirillzyusko/react-native-keyboard-controller#704

Would you mind to try to test it? 👀

@kirillzyusko
Copy link
Contributor

Also you can reach out to me via discord (nickname is kiryl.ziusko)

Currently @hirbod sending me yours findings in Discord, so maybe if we could have a direct channel of communication it would be more effective 😊

@mozzius
Copy link
Member Author

mozzius commented Nov 26, 2024

Confirmed that that patch fixes the issue, however actually I think we want to go with this approach - KeyboardStickyView currently moves slightly differently than the List, this aligns the behaviour so that they move together

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

code lgtm, let's verify it works well on device

@mozzius mozzius force-pushed the samuel/dms-keyboard-bug-2 branch from fc26529 to 1de6a1c Compare November 26, 2024 15:57
@arcalinea arcalinea temporarily deployed to samuel/dms-keyboard-bug-2 - social-app PR #6739 November 26, 2024 15:57 — with Render Destroyed
@mozzius mozzius merged commit 736ea3f into main Nov 26, 2024
@mozzius mozzius deleted the samuel/dms-keyboard-bug-2 branch November 26, 2024 15:57
kirillzyusko added a commit to kirillzyusko/react-native-keyboard-controller 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants