Skip to content

fix: dynamic bottomOffset over-scrolling#1204

Merged
kirillzyusko merged 3 commits intomainfrom
fix/dynamic-bottom-offset-overscrolling
Nov 14, 2025
Merged

fix: dynamic bottomOffset over-scrolling#1204
kirillzyusko merged 3 commits intomainfrom
fix/dynamic-bottom-offset-overscrolling

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented Nov 13, 2025

📜 Description

Fixed an issue when change of bottomSheet with opened keyboard leads to unexpectedly big scroll.

💡 Motivation and Context

The issue is that our point/relativeScrollTo remains the same. But when we focus our input we get scrollPosition.value === 0. When scrolling has completed we update that value to an actual scroll position (let's say to 209). When bottomOffset gets changed we scroll from current position (remember point hasn't been changed) but we add already scrolled distance and we get an incorrect offset.

To overcome this issue we need to reset our scroll position to "unscrolled" state. In fact we already use that pattern with scroll restoration (change scroll position, call maybeScroll, restore position). So I decided to create a utility function called performScrollWithRestoration that will substitute scroll to a new position, do a scrolling and restore original position.

The fix is working well, it fixes a problem in example app and e2e tests successfully pass 🤞

Closes #1203

📢 Changelog

JS

  • added performScrollWithRestoration utility function;
  • call performScrollWithRestoration when bottomOffset gets changed (passing scrollBeforeKeyboardMovement value).

🤔 How Has This Been Tested?

Tested manually in Fabric example, iPhone 16 Pro (iOS 26.0).

📸 Screenshots (if appropriate):

Before After
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-11-13.at.10.40.52.mov
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-11-13.at.10.39.53.mov

📝 Checklist

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

@kirillzyusko kirillzyusko self-assigned this Nov 13, 2025
@kirillzyusko kirillzyusko added 🐛 bug Something isn't working KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component labels Nov 13, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 13, 2025

📊 Package size report

Current size Target Size Difference
225067 bytes 224651 bytes 416 bytes 📈

@kirillzyusko kirillzyusko merged commit 852fa4a into main Nov 14, 2025
20 of 21 checks passed
@kirillzyusko kirillzyusko deleted the fix/dynamic-bottom-offset-overscrolling branch November 14, 2025 13:22
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scrolling too much when the height of a KeyboardStickyView changes

1 participant