From 64e050793e49c2439378a6017701a7da83c4bad3 Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Wed, 24 Feb 2016 13:13:35 -0800 Subject: [PATCH] Split StateBuilder.ensureBackingViewIsCreated into 2 different methods Summary: There are 2 reasons why someone would call StateBuilder.ensureBackingViewIsCreated(): 1) to make sure a View is created, because we are going to use it NOW 2) make sure react styles are applied to View, which doesn't really need the View to be created immediately This diff is splitting the method into 2, without changing behavior. Difference between the methods' signatures is coming from the fact that 1) never takes styles and 2) possibly takes styles. This is a pure refactoring diff and should have no change in functionality or behavior. Reviewed By: ahmedre Differential Revision: D2916697 --- .../java/com/facebook/react/flat/StateBuilder.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java index e1482a667..6bea7396e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java @@ -143,6 +143,17 @@ import com.facebook.react.uimanager.events.EventDispatcher; node.signalBackingViewIsCreated(); } + /* package */ void ensureBackingViewIsCreated(FlatShadowNode node) { + if (node.isBackingViewCreated()) { + return; + } + + int tag = node.getReactTag(); + mOperationsQueue.enqueueCreateView(node.getThemedContext(), tag, node.getViewClass(), null); + + node.signalBackingViewIsCreated(); + } + /* package */ void dropView(FlatShadowNode node) { mViewsToDrop.add(node); }