Skip to content

Commit fa0ac92

Browse files
fkgozalifacebook-github-bot
authored andcommitted
call into native FabricUIManager from JS
Reviewed By: mdvacca Differential Revision: D6945104 fbshipit-source-id: ac66c6105c0d18bef003cdd08d06dbb49c61e669
1 parent 2d35bde commit fa0ac92

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

Libraries/ReactNative/FabricUIManager.js

+50-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,53 @@
1212
*/
1313
'use strict';
1414

15-
// TODO @sema Fix me
16-
module.exports = {};
15+
// TODO: fix the types
16+
type Node = number;
17+
type NodeSet = number;
18+
type NodeProps = {};
19+
type Spec = {|
20+
+createNode: (
21+
reactTag: number,
22+
viewName: string,
23+
rootTag: number,
24+
props: NodeProps,
25+
instanceHandle: number,
26+
) => Node,
27+
+cloneNode: (node: Node) => Node,
28+
+cloneNodeWithNewChildren: (node: Node) => Node,
29+
+cloneNodeWithNewProps: (node: Node, newProps: NodeProps) => Node,
30+
+cloneNodeWithNewChildrenAndProps: (node: Node, newProps: NodeProps) => Node,
31+
+appendChild: (parentNode: Node, child: Node) => Node,
32+
+appendChildToSet: (childSet: NodeSet, child: Node) => void,
33+
+completeRoot: (rootTag: number, childSet: NodeSet) => void,
34+
|};
35+
36+
const NativeFabricUIManager: Spec = require('NativeModules').FabricUIManager;
37+
38+
const FabricUIManager: Spec = {
39+
createNode(
40+
reactTag: number,
41+
viewName: string,
42+
rootTag: number,
43+
props: NodeProps,
44+
instanceHandle: number,
45+
): number {
46+
return NativeFabricUIManager.createNode(
47+
reactTag,
48+
viewName,
49+
rootTag,
50+
props,
51+
0, // TODO: instanceHandle is cannot be JSON serialized.
52+
);
53+
},
54+
cloneNode: NativeFabricUIManager.cloneNode,
55+
cloneNodeWithNewChildren: NativeFabricUIManager.cloneNodeWithNewChildren,
56+
cloneNodeWithNewProps: NativeFabricUIManager.cloneNodeWithNewProps,
57+
cloneNodeWithNewChildrenAndProps:
58+
NativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
59+
appendChild: NativeFabricUIManager.appendChild,
60+
appendChildToSet: NativeFabricUIManager.appendChildToSet,
61+
completeRoot: NativeFabricUIManager.completeRoot,
62+
};
63+
64+
module.exports = FabricUIManager;

Libraries/Renderer/ReactFabric-dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4718,7 +4718,7 @@ var enableMutatingReconciler = true;
47184718
// Experimental noop mode (currently unused):
47194719
var enableNoopReconciler = false;
47204720
// Experimental persistent mode (Fabric):
4721-
var enablePersistentReconciler = false;
4721+
var enablePersistentReconciler = true;
47224722
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
47234723
var debugRenderPhaseSideEffects = false;
47244724

0 commit comments

Comments
 (0)