33package com .facebook .react .fabric ;
44
55import com .facebook .react .bridge .ReactApplicationContext ;
6- import com .facebook .react .bridge .ReactContextBaseJavaModule ;
7- import com .facebook .react .bridge .ReactMethod ;
86import com .facebook .react .bridge .ReadableMap ;
9- import com .facebook .react .module .annotations .ReactModule ;
107import com .facebook .react .uimanager .ReactShadowNode ;
8+ import java .util .ArrayList ;
9+ import java .util .List ;
10+ import javax .annotation .Nullable ;
1111
1212/**
13- * <p>Native module to allow JS to create and update native Views using Fabric API.</p>
14- *
13+ * This class is responsible to create, clone and update {@link ReactShadowNode} using the
14+ * Fabric API.
1515 */
16- @ ReactModule (name = FabricUIManagerModule .NAME )
17- public class FabricUIManagerModule extends ReactContextBaseJavaModule {
16+ public class FabricUIManagerModule {
1817
19- static final String NAME = "FabricUIManager" ;
18+ private final ReactApplicationContext mReactApplicationContext ;
2019
2120 public FabricUIManagerModule (ReactApplicationContext reactContext ) {
22- super ( reactContext ) ;
21+ mReactApplicationContext = reactContext ;
2322 }
2423
2524 /**
2625 * Creates a new {@link ReactShadowNode}
2726 */
28- @ ReactMethod ( isBlockingSynchronousMethod = true )
29- public int createNode (int reactTag ,
27+ @ Nullable
28+ public ReactShadowNode createNode (int reactTag ,
3029 String viewName ,
3130 int rootTag ,
3231 ReadableMap props ,
3332 int instanceHandle ) {
3433 //TODO T25560658
35- return - 1 ;
34+ return null ;
3635 }
3736
3837 /**
3938 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
4039 * ReactShadowNode will contain a copy of all the internal data of the original node, including
4140 * its children set (note that the children nodes will not be cloned).
4241 */
43- @ ReactMethod ( isBlockingSynchronousMethod = true )
44- public int cloneNode (int node ) {
42+ @ Nullable
43+ public ReactShadowNode cloneNode (ReactShadowNode node ) {
4544 //TODO T25560658
46- return - 1 ;
45+ return null ;
4746 }
4847
4948 /**
5049 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
5150 * ReactShadowNode will contain a copy of all the internal data of the original node, but
5251 * its children set will be empty.
5352 */
54- @ ReactMethod ( isBlockingSynchronousMethod = true )
55- public int cloneNodeWithNewChildren (int node ) {
53+ @ Nullable
54+ public ReactShadowNode cloneNodeWithNewChildren (ReactShadowNode node ) {
5655 //TODO T25560658
57- return - 1 ;
56+ return null ;
5857 }
5958
6059 /**
6160 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
6261 * ReactShadowNode will contain a copy of all the internal data of the original node, but its
6362 * props will be overridden with the {@link ReadableMap} received by parameter.
6463 */
65- @ ReactMethod ( isBlockingSynchronousMethod = true )
66- public int cloneNodeWithNewProps (int node , ReadableMap newProps ) {
64+ @ Nullable
65+ public ReactShadowNode cloneNodeWithNewProps (ReactShadowNode node , ReadableMap newProps ) {
6766 //TODO T25560658
68- return - 1 ;
67+ return null ;
6968 }
7069
7170 /**
@@ -74,41 +73,40 @@ public int cloneNodeWithNewProps(int node, ReadableMap newProps) {
7473 * props will be overridden with the {@link ReadableMap} received by parameter and its children
7574 * set will be empty.
7675 */
77- @ ReactMethod ( isBlockingSynchronousMethod = true )
78- public int cloneNodeWithNewChildrenAndProps (
79- int node ,
76+ @ Nullable
77+ public ReactShadowNode cloneNodeWithNewChildrenAndProps (
78+ ReactShadowNode node ,
8079 ReadableMap newProps ) {
8180 //TODO T25560658
82- return - 1 ;
81+ return null ;
8382 }
8483
8584 /**
8685 * Appends the child {@link ReactShadowNode} to the children set of the parent
8786 * {@link ReactShadowNode}.
8887 */
89- @ ReactMethod
90- public void appendChild (int parent , int child ) {
88+ @ Nullable
89+ public void appendChild (ReactShadowNode parent , ReactShadowNode child ) {
9190 //TODO T25560658
9291 }
9392
94- @ ReactMethod (isBlockingSynchronousMethod = true )
95- public int createChildSet () {
96- //TODO T25560658
97- return -1 ;
93+ /**
94+ * @return an empty {@link List<ReactShadowNode>} that will be used to append the
95+ * {@link ReactShadowNode} elements of the root. Typically this List will contain one element.
96+ */
97+ public List <ReactShadowNode > createChildSet () {
98+ return new ArrayList <>(1 );
9899 }
99100
100- @ ReactMethod
101- public void appendChildToSet (int childSet , int child ) {
102- //TODO T25560658
101+ /**
102+ * Adds the {@link ReactShadowNode} to the {@link List<ReactShadowNode>} received by parameter.
103+ */
104+ public void appendChildToSet (List <ReactShadowNode > childList , ReactShadowNode child ) {
105+ childList .add (child );
103106 }
104107
105- @ ReactMethod
106- public void completeRoot (int rootTag , int childSet ) {
108+ public void completeRoot (int rootTag , List <ReactShadowNode > childList ) {
107109 //TODO T25560658
108110 }
109111
110- @ Override
111- public String getName () {
112- return NAME ;
113- }
114112}
0 commit comments