Skip to content

Commit

Permalink
Introduce new Fabric API in RNAndroid
Browse files Browse the repository at this point in the history
Summary: Introduce new Fabric FabricUIManagerModule RNAndroid

Reviewed By: achen1

Differential Revision: D6833154

fbshipit-source-id: 9ab7ff8bf0c407d833c512eb3455969573f138da
  • Loading branch information
mdvacca authored and facebook-github-bot committed Feb 9, 2018
1 parent 4f883bd commit 2d35bde
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load("//ReactNative:DEFS.bzl", "rn_android_library", "react_native_dep", "react_native_target")

android_library(
name = "fabric",
srcs = glob(["*.java"]),
provided_deps = [
react_native_dep("third-party/android/support/v4:lib-support-v4"),
],
required_for_source_only_abi = True,
visibility = [
"PUBLIC",
],
deps = [
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("libraries/fresco/fresco-react-native:fbcore"),
react_native_dep("libraries/fresco/fresco-react-native:fresco-drawee"),
react_native_dep("libraries/fresco/fresco-react-native:fresco-react-native"),
react_native_dep("libraries/fresco/fresco-react-native:imagepipeline"),
react_native_dep("libraries/textlayoutbuilder:textlayoutbuilder"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react:reactAndroid"),
react_native_target("java/com/facebook/react/bridge:bridgeAndroid"),
react_native_target("java/com/facebook/react/common:commonAndroid"),
react_native_target("java/com/facebook/react/devsupport:devsupportAndroid"),
react_native_target("java/com/facebook/react/modules/core:coreAndroid"),
react_native_target("java/com/facebook/react/shell:shellAndroid"),
react_native_target("java/com/facebook/react/uimanager:uimanagerAndroid"),
react_native_target("java/com/facebook/react/uimanager/annotations:annotationsAndroid"),
react_native_target("java/com/facebook/react/module/annotations:annotationsAndroid"),
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright 2004-present Facebook. All Rights Reserved.

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;

/**
* <p>Native module to allow JS to create and update native Views using Fabric API.</p>
*
*/
@ReactModule(name = FabricUIManagerModule.NAME)
public class FabricUIManagerModule extends ReactContextBaseJavaModule {

static final String NAME = "FabricUIManager";

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

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

/**
* @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) {
//TODO T25560658
return -1;
}

/**
* @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) {
//TODO T25560658
return -1;
}

/**
* @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) {
//TODO T25560658
return -1;
}

/**
* @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 and its children
* set will be empty.
*/
@ReactMethod(isBlockingSynchronousMethod = true)
public int cloneNodeWithNewChildrenAndProps(
int node,
ReadableMap newProps) {
//TODO T25560658
return -1;
}

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

@ReactMethod(isBlockingSynchronousMethod = true)
public int createChildSet() {
//TODO T25560658
return -1;
}

@ReactMethod
public void appendChildToSet(int childSet, int child) {
//TODO T25560658
}

@ReactMethod
public void completeRoot(int rootTag, int childSet) {
//TODO T25560658
}

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

0 comments on commit 2d35bde

Please sign in to comment.