Skip to content

fix: double synchronization#1017

Open
kirillzyusko wants to merge 5 commits intomainfrom
fix/double-synchronization-on-android
Open

fix: double synchronization#1017
kirillzyusko wants to merge 5 commits intomainfrom
fix/double-synchronization-on-android

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented Jul 13, 2025

To Do

  • Android, cold start, Modal screen, quickly focus input -> show Modal -> red circle on first screen stays frozen (API 33)

📜 Description

Fixed an issue when system windows (share bottom sheet, Modals, etc.) closes keyboard and these events are not propagated to JS.

💡 Motivation and Context

On Android 16 callback methods, such as onStart/onMove/onEnd may not be invoked at all, when system sheet (Share etc.) closes a keyboard.

Closes #1006

📢 Changelog

Android

  • change isTransitioning inside onPrepare;
  • pass optional insets to getCurrentKeyboardHeight for reading actual keyboard height from insets (not root view);

🤔 How Has This Been Tested?

Tested manually on:

  • Pixel 8 (API 36, emulator)
  • Pixel 7 Pro (API 36, real device)
  • Redmi Note 5 Pro (API 28, real device)

📸 Screenshots (if appropriate):

Before After
Screen.Recording.2026-04-13.at.13.01.42.mov
Screen.Recording.2026-04-13.at.12.51.16.mov

Modal show causes a keyboard close

API 28 (with these changes) API 28 (without PR changes)
image
API 33 (with these changes) API 33 (without PR changes)

📝 Checklist

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

@kirillzyusko kirillzyusko self-assigned this Jul 13, 2025
@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🤖 android Android specific labels Jul 13, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 13, 2025

📊 Package size report

Current size Target Size Difference
313099 bytes 312992 bytes 107 bytes 📈

@kirillzyusko kirillzyusko force-pushed the fix/double-synchronization-on-android branch 2 times, most recently from 5097947 to abfb5b7 Compare July 16, 2025 18:03
@kirillzyusko kirillzyusko force-pushed the fix/double-synchronization-on-android branch from 78073c7 to 0cfd049 Compare August 1, 2025 12:53
@kirillzyusko kirillzyusko force-pushed the fix/double-synchronization-on-android branch from 0cfd049 to c3d74ea Compare September 16, 2025 11:56
kirillzyusko added a commit that referenced this pull request Dec 12, 2025
…after interactive dismissal (#1240)

## 📜 Description

Fixed wrong event for "end" keyboard movement after interactive
dismissal (when keyboard gets shown after interaction).

## 💡 Motivation and Context

Originally reported by @pioner92 months ago and later raised as an issue
by @iankberry

It's a known issue that in `onEnd` we may get out-of-dated keyboard
frame metrics. The fix that I used earlier was postponing the event a
little bit if it was interactive dismissal. It fixed the issue for my
pixel device in
#814

However if we test Samsung device we can clearly see that the bug is
reproducible again. In this PR I'm continue to use the idea introduced
in
#814
and just use larger delay. It fixes the problem, but I'll conduct an
exploration for a better/more synchronous code. I started this
investigation in
#1017
and I plan to return to this PR soon 👀 (but for now we'll merge a
workaround)

Closes
#1238

## 📢 Changelog

<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->

### JS

- added `onEnd` handler in "Interactive Keyboard" example

### Android

- added `UIThread` constants;
- use `.postDelayed()` instead of `.post()` with one frame delay;

## 🤔 How Has This Been Tested?

Tested manually on Samsung S25+, Android 15 (Remote test lab) in example
app.

## 📸 Screenshots (if appropriate):

|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/45e63086-e49f-4b53-b4c1-647045021709">|<video
src="https://github.com/user-attachments/assets/bafc21c1-49f3-4ea0-a248-1d587feedfbc">|

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
@kirillzyusko kirillzyusko force-pushed the fix/double-synchronization-on-android branch from c3d74ea to a284579 Compare April 13, 2026 10:23
@kirillzyusko kirillzyusko marked this pull request as ready for review April 13, 2026 10:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

  • LGTM

```
onKeyboardMove {target: -1, height: 250.90908813476562, duration: 0, progress: 1, eventName: 'onKeyboardMove'}
console.js:661 onKeyboardMoveEnd {target: -1, height: 250.90908813476562, duration: 0, progress: 1, eventName: 'onKeyboardMoveEnd'}
console.js:661 onKeyboardMove {target: -1, height: 0, duration: 0, progress: 0, eventName: 'onKeyboardMove'}
console.js:661 onKeyboardMoveEnd {target: -1, height: 0, duration: 0, progress: 0, eventName: 'onKeyboardMoveEnd'}
```

using native driver can coalesce to height: 250.90908813476562 which is technically incorrect
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.

Share text doesn't report keyboard dismissal

1 participant