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
2019-05-21 15:05:18 -07:00
committed by Facebook Github Bot
parent c9df1db00a
commit b05761f1bb
12 changed files with 67 additions and 41 deletions
@@ -83,7 +83,7 @@ public class SimpleViewPropertyTest {
@Test
public void testOpacity() {
View view = mManager.createViewWithProps(mThemedContext, buildStyles(), new JSResponderHandler());
View view = mManager.createView(mThemedContext, buildStyles(), null, new JSResponderHandler());
mManager.updateProperties(view, buildStyles());
assertThat(view.getAlpha()).isEqualTo(1.0f);
@@ -97,7 +97,7 @@ public class SimpleViewPropertyTest {
@Test
public void testBackgroundColor() {
View view = mManager.createViewWithProps(mThemedContext, buildStyles(), new JSResponderHandler());
View view = mManager.createView(mThemedContext, buildStyles(), null, new JSResponderHandler());
mManager.updateProperties(view, buildStyles());
assertThat(view.getBackground()).isEqualTo(null);