Skip to content

Commit 2d35bde

Browse files
mdvaccafacebook-github-bot
authored andcommittedFeb 9, 2018
Introduce new Fabric API in RNAndroid
Summary: Introduce new Fabric FabricUIManagerModule RNAndroid Reviewed By: achen1 Differential Revision: D6833154 fbshipit-source-id: 9ab7ff8bf0c407d833c512eb3455969573f138da
1 parent 4f883bd commit 2d35bde

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
load("//ReactNative:DEFS.bzl", "rn_android_library", "react_native_dep", "react_native_target")
2+
3+
android_library(
4+
name = "fabric",
5+
srcs = glob(["*.java"]),
6+
provided_deps = [
7+
react_native_dep("third-party/android/support/v4:lib-support-v4"),
8+
],
9+
required_for_source_only_abi = True,
10+
visibility = [
11+
"PUBLIC",
12+
],
13+
deps = [
14+
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
15+
react_native_dep("libraries/fresco/fresco-react-native:fbcore"),
16+
react_native_dep("libraries/fresco/fresco-react-native:fresco-drawee"),
17+
react_native_dep("libraries/fresco/fresco-react-native:fresco-react-native"),
18+
react_native_dep("libraries/fresco/fresco-react-native:imagepipeline"),
19+
react_native_dep("libraries/textlayoutbuilder:textlayoutbuilder"),
20+
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
21+
react_native_dep("third-party/java/jsr-305:jsr-305"),
22+
react_native_target("java/com/facebook/react:reactAndroid"),
23+
react_native_target("java/com/facebook/react/bridge:bridgeAndroid"),
24+
react_native_target("java/com/facebook/react/common:commonAndroid"),
25+
react_native_target("java/com/facebook/react/devsupport:devsupportAndroid"),
26+
react_native_target("java/com/facebook/react/modules/core:coreAndroid"),
27+
react_native_target("java/com/facebook/react/shell:shellAndroid"),
28+
react_native_target("java/com/facebook/react/uimanager:uimanagerAndroid"),
29+
react_native_target("java/com/facebook/react/uimanager/annotations:annotationsAndroid"),
30+
react_native_target("java/com/facebook/react/module/annotations:annotationsAndroid"),
31+
],
32+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// Copyright 2004-present Facebook. All Rights Reserved.
2+
3+
package com.facebook.react.fabric;
4+
5+
import com.facebook.react.bridge.ReactApplicationContext;
6+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
7+
import com.facebook.react.bridge.ReactMethod;
8+
import com.facebook.react.bridge.ReadableMap;
9+
import com.facebook.react.module.annotations.ReactModule;
10+
import com.facebook.react.uimanager.ReactShadowNode;
11+
12+
/**
13+
* <p>Native module to allow JS to create and update native Views using Fabric API.</p>
14+
*
15+
*/
16+
@ReactModule(name = FabricUIManagerModule.NAME)
17+
public class FabricUIManagerModule extends ReactContextBaseJavaModule {
18+
19+
static final String NAME = "FabricUIManager";
20+
21+
public FabricUIManagerModule(ReactApplicationContext reactContext) {
22+
super(reactContext);
23+
}
24+
25+
/**
26+
* Creates a new {@link ReactShadowNode}
27+
*/
28+
@ReactMethod(isBlockingSynchronousMethod = true)
29+
public int createNode(int reactTag,
30+
String viewName,
31+
int rootTag,
32+
ReadableMap props,
33+
int instanceHandle) {
34+
//TODO T25560658
35+
return -1;
36+
}
37+
38+
/**
39+
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
40+
* ReactShadowNode will contain a copy of all the internal data of the original node, including
41+
* its children set (note that the children nodes will not be cloned).
42+
*/
43+
@ReactMethod(isBlockingSynchronousMethod = true)
44+
public int cloneNode(int node) {
45+
//TODO T25560658
46+
return -1;
47+
}
48+
49+
/**
50+
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
51+
* ReactShadowNode will contain a copy of all the internal data of the original node, but
52+
* its children set will be empty.
53+
*/
54+
@ReactMethod(isBlockingSynchronousMethod = true)
55+
public int cloneNodeWithNewChildren(int node) {
56+
//TODO T25560658
57+
return -1;
58+
}
59+
60+
/**
61+
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
62+
* ReactShadowNode will contain a copy of all the internal data of the original node, but its
63+
* props will be overridden with the {@link ReadableMap} received by parameter.
64+
*/
65+
@ReactMethod(isBlockingSynchronousMethod = true)
66+
public int cloneNodeWithNewProps(int node, ReadableMap newProps) {
67+
//TODO T25560658
68+
return -1;
69+
}
70+
71+
/**
72+
* @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
73+
* ReactShadowNode will contain a copy of all the internal data of the original node, but its
74+
* props will be overridden with the {@link ReadableMap} received by parameter and its children
75+
* set will be empty.
76+
*/
77+
@ReactMethod(isBlockingSynchronousMethod = true)
78+
public int cloneNodeWithNewChildrenAndProps(
79+
int node,
80+
ReadableMap newProps) {
81+
//TODO T25560658
82+
return -1;
83+
}
84+
85+
/**
86+
* Appends the child {@link ReactShadowNode} to the children set of the parent
87+
* {@link ReactShadowNode}.
88+
*/
89+
@ReactMethod
90+
public void appendChild(int parent, int child) {
91+
//TODO T25560658
92+
}
93+
94+
@ReactMethod(isBlockingSynchronousMethod = true)
95+
public int createChildSet() {
96+
//TODO T25560658
97+
return -1;
98+
}
99+
100+
@ReactMethod
101+
public void appendChildToSet(int childSet, int child) {
102+
//TODO T25560658
103+
}
104+
105+
@ReactMethod
106+
public void completeRoot(int rootTag, int childSet) {
107+
//TODO T25560658
108+
}
109+
110+
@Override
111+
public String getName() {
112+
return NAME;
113+
}
114+
}

0 commit comments

Comments
 (0)
Please sign in to comment.