Commit f45a7d0
committed
Commit the Gesture lane if a gesture ends closer to the target state (#35486)
Stacked on #35485.
Before this PR, the `startGestureTransition` API would itself never
commit its state. After the gesture releases it stops the animation in
the next commit which just leaves the DOM tree in the original state. If
there's an actual state change from the Action then that's committed as
the new DOM tree. To avoid animating from the original state to the new
state again, this is DOM without an animation. However, this means that
you can't have the actual action committing be in a slightly different
state and animate between the final gesture state and into the new
action.
Instead, we now actually keep the render tree around and commit it in
the end. Basically we assume that if the Timeline was closer to the end
then visually you're already there and we can commit into that state.
Most of the time this will be at the actual end state when you release
but if you have something else cancelling the gesture (e.g.
`touchcancel`) it can still commit this state even though your gesture
recognizer might not consider this an Action. I think this is ok and
keeps it simple.
When the gesture lane commits, it'll leave a Transition behind as work
from the revert lanes on the Optimistic updates. This means that if you
don't do anything in the Action this will cause another commit right
after which reverts. This revert can animate the snap back.
There's a few fixes needed in follow up PRs:
- Fixed in #35487. ~To support unentangled Transitions we need to
explicitly entangle the revert lane with the Action to avoid committing
a revert followed by a forward instead of committing the forward
entangled with the revert. This just works now since everything is
entangled but won't work with #35392.~
- Fixed in #35510. ~This currently rerenders the gesture lane once
before committing if it was already completed but blocked. We should be
able to commit the already completed tree as is.~
DiffTrain build for [4028aaa](4028aaa)1 parent 68bfac4 commit f45a7d0
File tree
21 files changed
+1634
-1515
lines changed- compiled-rn
- facebook-fbsource/xplat/js
- RKJSModules/vendor/react
- react-dom/cjs
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
- implementations
- tools/eslint-plugin-react-hooks
21 files changed
+1634
-1515
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
414 | 414 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
Lines changed: 301 additions & 289 deletions
Large diffs are not rendered by default.
Lines changed: 69 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
11826 | 11826 | | |
11827 | 11827 | | |
11828 | 11828 | | |
11829 | | - | |
| 11829 | + | |
11830 | 11830 | | |
11831 | 11831 | | |
11832 | 11832 | | |
| |||
11847 | 11847 | | |
11848 | 11848 | | |
11849 | 11849 | | |
11850 | | - | |
| 11850 | + | |
11851 | 11851 | | |
11852 | 11852 | | |
11853 | 11853 | | |
| |||
11869 | 11869 | | |
11870 | 11870 | | |
11871 | 11871 | | |
11872 | | - | |
| 11872 | + | |
11873 | 11873 | | |
11874 | 11874 | | |
11875 | 11875 | | |
| |||
11919 | 11919 | | |
11920 | 11920 | | |
11921 | 11921 | | |
11922 | | - | |
| 11922 | + | |
11923 | 11923 | | |
11924 | 11924 | | |
11925 | 11925 | | |
| |||
11930 | 11930 | | |
11931 | 11931 | | |
11932 | 11932 | | |
| 11933 | + | |
11933 | 11934 | | |
11934 | 11935 | | |
11935 | 11936 | | |
| |||
11941 | 11942 | | |
11942 | 11943 | | |
11943 | 11944 | | |
11944 | | - | |
| 11945 | + | |
11945 | 11946 | | |
11946 | 11947 | | |
11947 | 11948 | | |
| |||
12491 | 12492 | | |
12492 | 12493 | | |
12493 | 12494 | | |
12494 | | - | |
| 12495 | + | |
12495 | 12496 | | |
12496 | 12497 | | |
12497 | 12498 | | |
| |||
12508 | 12509 | | |
12509 | 12510 | | |
12510 | 12511 | | |
12511 | | - | |
12512 | | - | |
12513 | | - | |
12514 | | - | |
12515 | | - | |
12516 | | - | |
12517 | | - | |
12518 | | - | |
12519 | | - | |
12520 | | - | |
12521 | 12512 | | |
12522 | 12513 | | |
12523 | 12514 | | |
12524 | 12515 | | |
12525 | 12516 | | |
12526 | 12517 | | |
12527 | | - | |
12528 | 12518 | | |
12529 | 12519 | | |
12530 | | - | |
12531 | | - | |
12532 | | - | |
12533 | | - | |
12534 | | - | |
12535 | | - | |
12536 | | - | |
12537 | | - | |
12538 | | - | |
12539 | | - | |
12540 | | - | |
12541 | | - | |
12542 | | - | |
12543 | | - | |
12544 | | - | |
12545 | | - | |
12546 | | - | |
12547 | | - | |
12548 | | - | |
12549 | | - | |
12550 | | - | |
12551 | | - | |
12552 | | - | |
12553 | | - | |
| 12520 | + | |
| 12521 | + | |
| 12522 | + | |
| 12523 | + | |
| 12524 | + | |
| 12525 | + | |
| 12526 | + | |
| 12527 | + | |
| 12528 | + | |
| 12529 | + | |
| 12530 | + | |
| 12531 | + | |
| 12532 | + | |
| 12533 | + | |
| 12534 | + | |
| 12535 | + | |
| 12536 | + | |
| 12537 | + | |
| 12538 | + | |
| 12539 | + | |
| 12540 | + | |
| 12541 | + | |
| 12542 | + | |
| 12543 | + | |
| 12544 | + | |
| 12545 | + | |
| 12546 | + | |
| 12547 | + | |
| 12548 | + | |
| 12549 | + | |
| 12550 | + | |
| 12551 | + | |
| 12552 | + | |
| 12553 | + | |
| 12554 | + | |
| 12555 | + | |
| 12556 | + | |
| 12557 | + | |
| 12558 | + | |
| 12559 | + | |
| 12560 | + | |
| 12561 | + | |
| 12562 | + | |
| 12563 | + | |
| 12564 | + | |
| 12565 | + | |
| 12566 | + | |
| 12567 | + | |
| 12568 | + | |
| 12569 | + | |
| 12570 | + | |
| 12571 | + | |
12554 | 12572 | | |
12555 | | - | |
12556 | | - | |
12557 | | - | |
12558 | | - | |
12559 | 12573 | | |
| 12574 | + | |
| 12575 | + | |
| 12576 | + | |
| 12577 | + | |
12560 | 12578 | | |
12561 | 12579 | | |
12562 | 12580 | | |
| |||
17701 | 17719 | | |
17702 | 17720 | | |
17703 | 17721 | | |
17704 | | - | |
| 17722 | + | |
17705 | 17723 | | |
17706 | 17724 | | |
17707 | 17725 | | |
17708 | 17726 | | |
17709 | 17727 | | |
17710 | 17728 | | |
17711 | | - | |
| 17729 | + | |
17712 | 17730 | | |
17713 | 17731 | | |
17714 | 17732 | | |
| |||
17730 | 17748 | | |
17731 | 17749 | | |
17732 | 17750 | | |
17733 | | - | |
| 17751 | + | |
17734 | 17752 | | |
17735 | 17753 | | |
17736 | | - | |
| 17754 | + | |
17737 | 17755 | | |
17738 | 17756 | | |
17739 | 17757 | | |
| |||
17840 | 17858 | | |
17841 | 17859 | | |
17842 | 17860 | | |
17843 | | - | |
| 17861 | + | |
0 commit comments