Commit 2bbea50
Restore scroll state of scroll view on mount (#54000)
Summary:
Pull Request resolved: #54000
Update the scroll view manager to load the fabric state and restore the scroll position and scroll away top padding on mount. Restoring the scroll view happens in the react scroll view state setter, which gets called by the `ReactScrollViewHelper` with the deserialized state provided on mount.
The state loading will happen only until the scroll view itself submits a new state to Fabric (due to scrolling). This guarantees that we only restore the initial state on mount.
This diff also updates the scroll away top padding setter to support setting a new value without triggering a fabric state update.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D83247016
fbshipit-source-id: 7ae44b9f69c58da9e5163574073767aea2713b621 parent aa85da3 commit 2bbea50
3 files changed
Lines changed: 18 additions & 1 deletion
File tree
- packages/react-native/ReactAndroid
- api
- src/main/java/com/facebook/react/views/scroll
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5779 | 5779 | | |
5780 | 5780 | | |
5781 | 5781 | | |
| 5782 | + | |
5782 | 5783 | | |
5783 | 5784 | | |
5784 | 5785 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1439 | 1440 | | |
1440 | 1441 | | |
1441 | 1442 | | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
1442 | 1447 | | |
1443 | 1448 | | |
1444 | 1449 | | |
| |||
1458 | 1463 | | |
1459 | 1464 | | |
1460 | 1465 | | |
1461 | | - | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
1462 | 1469 | | |
1463 | 1470 | | |
1464 | 1471 | | |
| |||
1470 | 1477 | | |
1471 | 1478 | | |
1472 | 1479 | | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
1473 | 1486 | | |
1474 | 1487 | | |
1475 | 1488 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
387 | 390 | | |
388 | 391 | | |
389 | 392 | | |
| |||
0 commit comments