From 5850bd0785745653b4753cf6478361b959ff65fb Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 10 Apr 2019 16:10:38 -0700 Subject: [PATCH] Force Diffing algorithm to insert views Bottom Up (from children to root) Summary: This diff changes the way views are inserted by the diffing algorithm. Previously the diffing algorithm inserted views top-down, now it insert views bottom-up (same order as previous version of RN). Let say we need to create the following tree: ``` A --> B --> C | | --> D ``` Before, the diffing algorithm created the following list of instructions: ``` insert(A, B, 0) insert(B, C, 0) insert(B, D, 1) ``` After this diff, the insert instructions are going to be: ``` insert(B, C, 0) insert(B, D, 1) insert(A, B, 0) ``` Reviewed By: shergin Differential Revision: D14817454 fbshipit-source-id: 7aac1a1e1784c53bca2747aee80a5bc8ee788e7a --- ReactCommon/fabric/mounting/Differentiator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactCommon/fabric/mounting/Differentiator.cpp b/ReactCommon/fabric/mounting/Differentiator.cpp index 33610348a45..ac051bfde13 100644 --- a/ReactCommon/fabric/mounting/Differentiator.cpp +++ b/ReactCommon/fabric/mounting/Differentiator.cpp @@ -207,10 +207,10 @@ static void calculateShadowViewMutations( mutations.end(), deleteMutations.begin(), deleteMutations.end()); mutations.insert( mutations.end(), createMutations.begin(), createMutations.end()); - mutations.insert( - mutations.end(), insertMutations.begin(), insertMutations.end()); mutations.insert( mutations.end(), downwardMutations.begin(), downwardMutations.end()); + mutations.insert( + mutations.end(), insertMutations.begin(), insertMutations.end()); } ShadowViewMutationList calculateShadowViewMutations(