Skip to content

Commit

Permalink
Extend the FabricUIManagerModule class to integrate with JSI/JSC in A…
Browse files Browse the repository at this point in the history
…ndroid

Reviewed By: sebmarkbage

Differential Revision: D7005419

fbshipit-source-id: 6e65be5a922ddb29fde965f5df779cc92a996ecf
  • Loading branch information
mdvacca authored and Plo4ox committed Feb 17, 2018
1 parent f3c974b commit eb24982
Showing 1 changed file with 38 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,68 @@
package com.facebook.react.fabric;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.ReactShadowNode;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;

/**
* <p>Native module to allow JS to create and update native Views using Fabric API.</p>
*
* This class is responsible to create, clone and update {@link ReactShadowNode} using the
* Fabric API.
*/
@ReactModule(name = FabricUIManagerModule.NAME)
public class FabricUIManagerModule extends ReactContextBaseJavaModule {
public class FabricUIManagerModule {

static final String NAME = "FabricUIManager";
private final ReactApplicationContext mReactApplicationContext;

public FabricUIManagerModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactApplicationContext = reactContext;
}

/**
* Creates a new {@link ReactShadowNode}
*/
@ReactMethod(isBlockingSynchronousMethod = true)
public int createNode(int reactTag,
@Nullable
public ReactShadowNode createNode(int reactTag,
String viewName,
int rootTag,
ReadableMap props,
int instanceHandle) {
//TODO T25560658
return -1;
return null;
}

/**
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
* ReactShadowNode will contain a copy of all the internal data of the original node, including
* its children set (note that the children nodes will not be cloned).
*/
@ReactMethod(isBlockingSynchronousMethod = true)
public int cloneNode(int node) {
@Nullable
public ReactShadowNode cloneNode(ReactShadowNode node) {
//TODO T25560658
return -1;
return null;
}

/**
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
* ReactShadowNode will contain a copy of all the internal data of the original node, but
* its children set will be empty.
*/
@ReactMethod(isBlockingSynchronousMethod = true)
public int cloneNodeWithNewChildren(int node) {
@Nullable
public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node) {
//TODO T25560658
return -1;
return null;
}

/**
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
* ReactShadowNode will contain a copy of all the internal data of the original node, but its
* props will be overridden with the {@link ReadableMap} received by parameter.
*/
@ReactMethod(isBlockingSynchronousMethod = true)
public int cloneNodeWithNewProps(int node, ReadableMap newProps) {
@Nullable
public ReactShadowNode cloneNodeWithNewProps(ReactShadowNode node, ReadableMap newProps) {
//TODO T25560658
return -1;
return null;
}

/**
Expand All @@ -74,41 +73,40 @@ public int cloneNodeWithNewProps(int node, ReadableMap newProps) {
* props will be overridden with the {@link ReadableMap} received by parameter and its children
* set will be empty.
*/
@ReactMethod(isBlockingSynchronousMethod = true)
public int cloneNodeWithNewChildrenAndProps(
int node,
@Nullable
public ReactShadowNode cloneNodeWithNewChildrenAndProps(
ReactShadowNode node,
ReadableMap newProps) {
//TODO T25560658
return -1;
return null;
}

/**
* Appends the child {@link ReactShadowNode} to the children set of the parent
* {@link ReactShadowNode}.
*/
@ReactMethod
public void appendChild(int parent, int child) {
@Nullable
public void appendChild(ReactShadowNode parent, ReactShadowNode child) {
//TODO T25560658
}

@ReactMethod(isBlockingSynchronousMethod = true)
public int createChildSet() {
//TODO T25560658
return -1;
/**
* @return an empty {@link List<ReactShadowNode>} that will be used to append the
* {@link ReactShadowNode} elements of the root. Typically this List will contain one element.
*/
public List<ReactShadowNode> createChildSet() {
return new ArrayList<>(1);
}

@ReactMethod
public void appendChildToSet(int childSet, int child) {
//TODO T25560658
/**
* Adds the {@link ReactShadowNode} to the {@link List<ReactShadowNode>} received by parameter.
*/
public void appendChildToSet(List<ReactShadowNode> childList, ReactShadowNode child) {
childList.add(child);
}

@ReactMethod
public void completeRoot(int rootTag, int childSet) {
public void completeRoot(int rootTag, List<ReactShadowNode> childList) {
//TODO T25560658
}

@Override
public String getName() {
return NAME;
}
}

0 comments on commit eb24982

Please sign in to comment.