Introduce "Sealing" of ReactShadowNodes

Summary: This diff introduces the concept of "Seal" ReactShadowNodes. This new field will be used to guarantee immutability of commited ReactShodow Nodes.

Reviewed By: fkgozali

Differential Revision: D8552709

fbshipit-source-id: dfd95730f10341af0dd762f8a8aa186563cf33e9
This commit is contained in:
David Vacca
2018-06-22 11:36:04 -07:00
committed by Facebook Github Bot
parent f19c36116c
commit 001e217f33
4 changed files with 45 additions and 6 deletions
@@ -233,6 +233,24 @@ public class FabricUIManagerTest {
mFabricUIManager.completeRoot(rootTag, children);
}
@Test
public void testSealReactShadowNode() {
ReactRootView rootView =
new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
int rootTag = mFabricUIManager.addRootView(rootView);
String viewClass = ReactViewManager.REACT_CLASS;
ReactShadowNode container = mFabricUIManager.createNode(6, viewClass, rootTag, null, randomInstanceHandle());
List<ReactShadowNode> childSet = mFabricUIManager.createChildSet(rootTag);
mFabricUIManager.appendChildToSet(childSet, container);
assertThat(container.isSealed()).isFalse();
mFabricUIManager.completeRoot(rootTag, childSet);
assertThat(container.isSealed()).isTrue();
}
/**
* Tests that cloned text nodes will not share measure functions
*/