From 27b3aecb3da65d7ab40ea844814a8cce317e2101 Mon Sep 17 00:00:00 2001 From: "Andrew Chen (Eng)" Date: Fri, 27 Jul 2018 14:07:17 -0700 Subject: [PATCH] Fix RN Litho invalidations Summary: We were seeing a bug where embedded feed stories showed the loading spinner forever until a scroll event occurred. Embedded feed stories are built on top of our RN + Litho integration which requires additional logic to support remeasuring the shadow tree when the intrinsic size of the litho component changes (aka wrap_content). Previously, we simply overrode requestLayout() of ReactLithoView to inform the shadow tree that that node needs to be dirtied -- in which case a subsequent layout pass would resolve these changes. This worked fine in dev builds, but it turns out that release builds never received a subsequent layout pass. Dev builds apparently have a loop that dispatches view updates every second or so while release doesn't (not sure why), but that was the reason why the dev version eventually invalidated the views. The solution here is to simply always invoke a view update when any embedded Litho component requires a relayout. Reviewed By: mdvacca Differential Revision: D8983995 fbshipit-source-id: 53c528b3c00aad2bbe8e7f6360dc8e1594da1298 --- .../main/java/com/facebook/react/uimanager/UIManagerModule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index 6be73b4e981..43befc9bad1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -777,6 +777,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements return; } node.dirty(); + mUIImplementation.dispatchViewUpdates(-1); } /**