Skip to content

Commit e9d5842

Browse files
bartlomiejbloniarztjzel
authored andcommitted
Fix layout animation crashes on the New Architecture (#6920)
## Summary This PR adds a `contains` check for layout animation config. When we schedule the start of an animation, we check if an animation is configured for the given view. But it might happen that before the `LayoutAnimationsManager::startLayoutAnimation` function gets executed, the view gets removed. When the view is removed we clear the config, so the `startLayoutAnimation` function will get a `nullptr` config, resulting in a crash. fixes #6908 ## Test plan
1 parent 2ea8822 commit e9d5842

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ void LayoutAnimationsManager::startLayoutAnimation(
116116
std::shared_ptr<Shareable> config, viewShareable;
117117
{
118118
auto lock = std::unique_lock<std::recursive_mutex>(animationsMutex_);
119+
if (!collection::contains(getConfigsForType(type), tag)) {
120+
return;
121+
}
119122
config = getConfigsForType(type)[tag];
120123
}
121124
// TODO: cache the following!!

0 commit comments

Comments
 (0)