mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
7df2af58c7
Summary: Fix a bug that happens when views are added and removed in the same manageChildren block with a delete animation. What happens is that the inserted view is not inserted at the proper index if the deleted view index is smaller than the inserted one. This is because the view is not immediately removed from the subviews array so we need to offset the insert index for each view that is going to be deleted with an animation and is before the inserted view. To do this I separated `_removeChildren` into 2 different functions, one for animated delete and one for normal delete. The animated one returns an array of `RCTComponent` that are going to be animated. We can then use this array to offset the insert index. **Test plan (required)** Tested that this fixed the bug in an app where I noticed it, also tested the UIExplorer example to make sure LayoutAnimations still worked properly. Closes https://github.com/facebook/react-native/pull/7942 Differential Revision: D3417194 Pulled By: bestander fbshipit-source-id: 9145a783e520c6718dd023a1e006646acb09cb7c