Commit 852fa4a
authored
fix: dynamic
## 📜 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
<!-- 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 `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|
|------|------|
|<video
src="https://github.com/user-attachments/assets/f01235d5-e94a-47fd-9221-fb74d4b495eb">|<video
src="https://github.com/user-attachments/assets/865f0a90-1766-43c7-ab9a-4ff961ba76fe">|
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changedbottomOffset over-scrolling (#1204)1 parent 3679bac commit 852fa4a
18 files changed
Lines changed: 78 additions & 13 deletions
File tree
- e2e/kit
- assets
- android
- e2e_emulator_28
- e2e_emulator_31
- ios
- iPhone 13 Pro
- iPhone 14 Pro
- iPhone 15 Pro
- iPhone 16 Pro
- iPhone 17 Pro
- src/components/KeyboardAwareScrollView
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
85 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments