|
12 | 12 | */
|
13 | 13 | 'use strict';
|
14 | 14 |
|
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; |
0 commit comments