mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor creation of views in Fabric Android
Summary: This diff refactors the createViewInstance method in order to ensure that viewID is set before props are updated in the view. This is necessary because there are components that deliver events at the same time their props are set. This means that some components might not have their viewId set correctly when events are delivered. Since viewId is used to determine if a view belongs to Fabric or Paper, there are cases when the events are not delivered to the right renderer changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D25667987 fbshipit-source-id: 4acfa8f80d66e9e59514354481957d7d3b571248
This commit is contained in:
committed by
Facebook GitHub Bot
parent
381fb395ad
commit
2e63147109
@@ -36,6 +36,8 @@ public class SimpleViewPropertyTest {
|
||||
|
||||
@Rule public PowerMockRule rule = new PowerMockRule();
|
||||
|
||||
private static int sViewTag = 2;
|
||||
|
||||
private static class ConcreteViewManager extends SimpleViewManager<View> {
|
||||
|
||||
@ReactProp(name = "foo")
|
||||
@@ -75,7 +77,9 @@ public class SimpleViewPropertyTest {
|
||||
|
||||
@Test
|
||||
public void testOpacity() {
|
||||
View view = mManager.createView(mThemedContext, buildStyles(), null, new JSResponderHandler());
|
||||
View view =
|
||||
mManager.createView(
|
||||
sViewTag, mThemedContext, buildStyles(), null, new JSResponderHandler());
|
||||
|
||||
mManager.updateProperties(view, buildStyles());
|
||||
assertThat(view.getAlpha()).isEqualTo(1.0f);
|
||||
@@ -89,7 +93,9 @@ public class SimpleViewPropertyTest {
|
||||
|
||||
@Test
|
||||
public void testBackgroundColor() {
|
||||
View view = mManager.createView(mThemedContext, buildStyles(), null, new JSResponderHandler());
|
||||
View view =
|
||||
mManager.createView(
|
||||
sViewTag, mThemedContext, buildStyles(), null, new JSResponderHandler());
|
||||
|
||||
mManager.updateProperties(view, buildStyles());
|
||||
assertThat(view.getBackground()).isEqualTo(null);
|
||||
|
||||
Reference in New Issue
Block a user