Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong exiting animation indices [New Architecture] #6526

Merged

Conversation

bartlomiejbloniarz
Copy link
Contributor

@bartlomiejbloniarz bartlomiejbloniarz commented Sep 20, 2024

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:

  useEffect(() => {
    setInterval(() => {
      setVisible((prev) => !prev);
    }, 0);
  }, []);

Copy link
Collaborator

@tjzel tjzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crazy Eyes

@bartlomiejbloniarz bartlomiejbloniarz added this pull request to the merge queue Sep 20, 2024
Merged via the queue into main with commit b8fb1de Sep 20, 2024
17 checks passed
@bartlomiejbloniarz bartlomiejbloniarz deleted the @bartlomiejbloniarz/fix-layout-animation-bugs-2 branch September 20, 2024 10:23
bartlomiejbloniarz added a commit that referenced this pull request Sep 20, 2024
## 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);
  }, []);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants