diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h index e6aba6e3c07..891d25d46d1 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h @@ -308,6 +308,14 @@ static inline bool shouldFirstComeBeforeSecondMutation( return true; } + // Update comes last, before deletes + if (rhs.type == ShadowViewMutation::Type::Update) { + return true; + } + if (lhs.type == ShadowViewMutation::Type::Update) { + return false; + } + // Remove comes before insert if (lhs.type == ShadowViewMutation::Type::Remove && rhs.type == ShadowViewMutation::Type::Insert) { @@ -317,6 +325,16 @@ static inline bool shouldFirstComeBeforeSecondMutation( lhs.type == ShadowViewMutation::Type::Insert) { return false; } + + // Create comes before insert + if (lhs.type == ShadowViewMutation::Type::Create && + rhs.type == ShadowViewMutation::Type::Insert) { + return true; + } + if (rhs.type == ShadowViewMutation::Type::Create && + lhs.type == ShadowViewMutation::Type::Insert) { + return false; + } } else { // Make sure that removes on the same level are sorted - highest indices // must come first.