Skip to content

fix: missing scroll animation when switching between inputs in KeyboardAwareScrollView#1484

Merged
kirillzyusko merged 3 commits into
mainfrom
fix/kasv-missing-scroll-animation-when-switching-between-inputs
Jun 3, 2026
Merged

fix: missing scroll animation when switching between inputs in KeyboardAwareScrollView#1484
kirillzyusko merged 3 commits into
mainfrom
fix/kasv-missing-scroll-animation-when-switching-between-inputs

Conversation

@kirillzyusko

@kirillzyusko kirillzyusko commented Jun 3, 2026

Copy link
Copy Markdown
Owner

📜 Description

Fixed a problem with missing animation in KeyboardAwareScrollView when switching between fields.

💡 Motivation and Context

The problem was because removeGhostPadding performed a synchronous scrollTo (which overrides the effect of prior scrollTo call with animation).

The fix is to skip the call when it's not necessary.

Additionally I tried to fix flakiness of KeyboardAwareScrollViewStickyView tests by increasing an interval between shared value update and call a function on a UI thread.

Closes #1483

📢 Changelog

JS

  • wrap runOnUI in requestAnimationFrame;
  • call removeGhostPadding only when keyboard is hidden (e.height === 0)
  • cover the regression with unit tests;

🤔 How Has This Been Tested?

Tested on iPhone 17 Pro (iOS 26.2) + e2e tests.

📸 Screenshots (if appropriate):

Before After
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-06-03.at.15.10.29.mov
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-06-03.at.15.09.15.mov

📝 Checklist

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

@kirillzyusko kirillzyusko self-assigned this Jun 3, 2026
@kirillzyusko kirillzyusko added 🐛 bug Something isn't working tests You added or changed unit tests KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component labels Jun 3, 2026
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
318050 bytes 317920 bytes 130 bytes 📈

…xcluding removeGhostPadding shouldn't cause a test failure - maybe it's just a coincidence so let's verify if artificial delay will fix the issue
@kirillzyusko kirillzyusko marked this pull request as ready for review June 3, 2026 13:44
@kirillzyusko kirillzyusko merged commit bd48253 into main Jun 3, 2026
18 checks passed
@kirillzyusko kirillzyusko deleted the fix/kasv-missing-scroll-animation-when-switching-between-inputs branch June 3, 2026 14:01
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
  1. Calling removeGhostPadding only when e.height is 0 can cause ghost padding to remain visible during same-height keyboard events
    Why: When the keyboard height remains the same but focus changes, ghost padding might not be removed properly, leading to incorrect layout or scroll offset calculations.
    Fix: Ensure removeGhostPadding is always called in onEnd, regardless of keyboard height.

  2. Wrapping scrollFromCurrentPosition in requestAnimationFrame and runOnUI can introduce timing issues
    Why: Delays in updating the UI could cause incorrect scroll positioning, especially during focus changes or layout updates.
    Fix: Remove the requestAnimationFrame wrapper to ensure immediate UI updates after scrolling calculations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component tests You added or changed unit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyboardAwareScrollView doesn't animate scroll position towards the end of the scrollable content

1 participant