Skip to content

Commit

Permalink
Fix wrong exiting animation indices [New Architecture] (#6526)
Browse files Browse the repository at this point in the history
## Summary

When an exiting animation is finished, we mark some views for removal.
Then we trigger `pullTransaction` to apply those removals. However, it
might happen that RN also tries to perform some transaction at the same
time. In the algorithm responsible for triggering exiting animations, if
we encounter a view marked for removal, we handle it right there by
calling `endAnimationsRecursively`. However, we also have to add this
view to the `toBeRemoved` list. Otherwise its neighbors will have
incorrect indices, and when one of them is removed the app will crash.

## Test plan

Test `[LA] View Flattening` example with:
```js
  useEffect(() => {
    setInterval(() => {
      setVisible((prev) => !prev);
    }, 0);
  }, []);
```
  • Loading branch information
bartlomiejbloniarz authored Sep 20, 2024
1 parent 93a79ae commit b8fb1de
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ bool LayoutAnimationsProxy::startAnimationsRecursively(
hasAnimatedChildren = true;
} else {
endAnimationsRecursively(subNode, mutations);
toBeRemoved.push_back(subNode);
}
} else if (startAnimationsRecursively(
subNode,
Expand Down

0 comments on commit b8fb1de

Please sign in to comment.