Pass State to preallocateView and createView methods whenever possible

Summary:
For some components, we will have state as soon as the ShadowNode is created that may be meaningful. In those cases, ViewManagers should be able to use State to create or preallocate views.

FB: This will be used in following diffs for Litho support.

Reviewed By: mdvacca

Differential Revision: D15343702

fbshipit-source-id: 8fd672251cb88dea662b5cae5a9efc96877d28a9
This commit is contained in:
Joshua Gross authored and Facebook Github Bot committed 2019-05-21 15:05:18 -07:00
1 parent c9df1db00a
commit b05761f1bb
12 files changed
+67 -41

No files matched your search

@@ -8,7 +8,6 @@
package com.facebook.react.uimanager;
import android.content.res.Resources;
import android.os.Build;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
@@ -19,7 +18,6 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.PopupMenu;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.R;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
@@ -256,7 +254,7 @@ public class NativeViewHierarchyManager {
try {
ViewManager viewManager = mViewManagers.get(className);
View view = viewManager.createViewWithProps(themedContext, null, mJSResponderHandler);
View view = viewManager.createView(themedContext, null, null, mJSResponderHandler);
mTagsToViews.put(tag, view);
mTagsToViewManagers.put(tag, viewManager);