KeyboardAvoidingView/Flatlist Scrolling When Modal Opened After TextInput Blurred Android Fix#1502
Closed
MatWaller wants to merge 2 commits into
Closed
KeyboardAvoidingView/Flatlist Scrolling When Modal Opened After TextInput Blurred Android Fix#1502MatWaller wants to merge 2 commits into
MatWaller wants to merge 2 commits into
Conversation
Contributor
📊 Package size report
|
…al opens and the keyboard is not open.
Author
|
@kirillzyusko Have updated pull request to remove example as don't feel it was needed fix is simple enough. |
2 tasks
kirillzyusko
added a commit
that referenced
this pull request
Jun 19, 2026
…#1503) ## 📜 Description Fixed an issue when closing a `Modal` triggers undesired scrolling in `KeyboardAwareScrollView`. ## 💡 Motivation and Context The issue is because when `Modal` gets closed we dispatch only `onMove`/`onEnd` events. In `KeyboardAwareScrollView` in `onStart` method we have a lot of logic that computes current input position before keyboard animation, calculates offset etc. If we skip this stage, then `onMove`/`onEnd` may use values from previous keyboard interaction (so if keyboard was closed before and we scrolled for ~100px) we may scroll again, because values from `onStart` were not updated. Technically that problem could be fixed in `KeyboardAwareScrollView` with additional conditions, but we use `useKeyboardHandler` hook in so many places/components, so if we would use this approach we potentially might need to replicate this fix in `KeyboardAvoidingView` and other components (and lib users would also need to do that if they use this hook in their projects). So I think the correct fix is to fix inconsistency in native code. Funny enough, but the new `syncKeyboardPosition` now becomes very similar to `onKeyboardResized`, especially since both functions are used in `onApplyWindowInsets` and I think that in the future these methods can be unified. Moreover the condition with detection keyboard resize or double keyboard position synchronization also can be unified and as a result we can make the codebase simpler. But this is the next step. First of all we need to merge/release this PR and keep an eye on possible bug reports about new bugs that caused by these changes 👀 Closes #1501 #1502 ## 📢 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 --> ### Android - send `onStart` event too from `syncKeyboardPosition` function; ## 🤔 How Has This Been Tested? Tested manually on Pixel 7 Pro (API 36, real device). ## 📸 Screenshots (if appropriate): |Before|After| |-------|-----| |<video src="https://github.com/user-attachments/assets/0a08edd8-ed27-4ee4-9b77-c469516d9e85">|<video src="https://github.com/user-attachments/assets/ab430e99-202f-4595-b8c1-225fc7378b11">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
Owner
|
Closing as it was handled in #1503 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Gaurding removeGhostPadding scrollTo when the keyboard is closed and a modal is opened.
Adding example flatlist form to example application
💡 Motivation and Context
Need this fix for a production application.
I have opened a bug report
📢 Changelog
Added guard to removeGhostPadding
JS
Added guard to removeGhostPadding
iOS
No native changes.
Android
No native changes.
🤔 How Has This Been Tested?
Ran through the exact steps to reproduce the issue outlines in the bug report and all is working as expected.
📸 Screenshots (if appropriate):
Have attached a video in the bug report - this no longer happens with this in place
📝 Checklist