Commit 423dbef
authored
## 📜 Description
Use `ScrollViewWithBottomPadding` component for
`KeyboardAwareScrollView` to optimize performance and fix other issues
that were caused by the fact of usage additional view inside
`ScrollView`.
## 💡 Motivation and Context
In this PR I'm moving away from the idea of having a fake view in the
end of the `ScrollView` and instead start to use
`ScrollViewWithBottomPadding` component to achieve a desired visual
effect.
The additional view causes many issues such as:
- unintended layout shift if `flex: 1` style is used;
- broken auto-grow for multiline input;
- unexpected styling issues if you use `gap`/`justifyContent:
"space-between"` and other properties.
In this PR I'm switching to the component that has been added in
#1294
With its new power I can achieve cross-platform behavior and:
- without layout modification add a scrollable padding;
- get the same behavior on both iOS/Android;
- don't use any hidden children that can break something.
This PR has been opened for a long time, but finally can be merged
because I got working version on Android.
Closes
#794
#645
#929
#168
Potentially:
#748
software-mansion/react-native-reanimated#5567
#719
Unlocks one item from
#883
## 📢 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 `useScrollState` hook;
- use `ScrollViewWithBottomPadding` component in
`KeyboardAwareScrollView`;
- added `removeGhostPadding` in `KeyboardAwareScrollView` and use it
there.
### E2E
- update assets for `KeyboardToolbarClosed` test-case.
## 🤔 How Has This Been Tested?
Tested manually on:
- iPhone 17 Pro (iOS 26.2, simulator);
- Pixel 7 Pro (API 36, real device);
- e2e_emulator_28 (API 28, emulator);;
- all e2e devices;
## 📸 Screenshots (if appropriate):
|iOS|Android|
|---|--------|
|<video
src="https://github.com/user-attachments/assets/adb98eb9-6ac0-436f-a5cc-3c795722401e">|<video
src="https://github.com/user-attachments/assets/07c4b5db-da79-4167-9d3e-c064817bf6f3">|
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
1 parent 7bf7ba1 commit 423dbef
11 files changed
Lines changed: 130 additions & 24 deletions
File tree
- android/src/main/java/com/reactnativekeyboardcontroller/views
- e2e/kit/assets
- android
- e2e_emulator_28
- e2e_emulator_31
- ios
- iPhone 13 Pro
- iPhone 14 Pro
- iPhone 15 Pro
- iPhone 16 Pro
- iPhone 16e
- iPhone 17 Pro
- src/components
- KeyboardAwareScrollView
- hooks
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Loading
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
134 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| |||
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| 151 | + | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
| |||
213 | 220 | | |
214 | 221 | | |
215 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
216 | 247 | | |
217 | 248 | | |
218 | 249 | | |
| |||
372 | 403 | | |
373 | 404 | | |
374 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
375 | 415 | | |
376 | 416 | | |
377 | 417 | | |
378 | 418 | | |
379 | 419 | | |
380 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
381 | 425 | | |
382 | 426 | | |
383 | 427 | | |
| |||
386 | 430 | | |
387 | 431 | | |
388 | 432 | | |
| 433 | + | |
| 434 | + | |
389 | 435 | | |
390 | 436 | | |
391 | 437 | | |
392 | 438 | | |
393 | 439 | | |
394 | 440 | | |
395 | | - | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
396 | 447 | | |
397 | 448 | | |
398 | 449 | | |
| |||
443 | 494 | | |
444 | 495 | | |
445 | 496 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
459 | 505 | | |
460 | 506 | | |
461 | 507 | | |
462 | 508 | | |
463 | | - | |
| 509 | + | |
464 | 510 | | |
465 | 511 | | |
| 512 | + | |
466 | 513 | | |
| 514 | + | |
467 | 515 | | |
468 | 516 | | |
469 | 517 | | |
470 | | - | |
471 | | - | |
| 518 | + | |
472 | 519 | | |
473 | 520 | | |
474 | 521 | | |
| |||
0 commit comments