diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK new file mode 100644 index 00000000000000..bc7ab5bbebc50d --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK @@ -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"), + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerModule.java new file mode 100644 index 00000000000000..548f31c7afda7c --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerModule.java @@ -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; + +/** + *

Native module to allow JS to create and update native Views using Fabric API.

+ * + */ +@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; + } +}