(
flexDirection?: FlexDirection,
size?: number,
children?: LayoutNode[],
data?: TabLayoutData
)
| 14 | * @returns The new node. |
| 15 | */ |
| 16 | export function newLayoutNode( |
| 17 | flexDirection?: FlexDirection, |
| 18 | size?: number, |
| 19 | children?: LayoutNode[], |
| 20 | data?: TabLayoutData |
| 21 | ): LayoutNode { |
| 22 | const newNode: LayoutNode = { |
| 23 | id: crypto.randomUUID(), |
| 24 | flexDirection: flexDirection ?? FlexDirection.Row, |
| 25 | size: size ?? DefaultNodeSize, |
| 26 | children, |
| 27 | data, |
| 28 | }; |
| 29 | |
| 30 | if (!validateNode(newNode)) { |
| 31 | throw new Error("Invalid node"); |
| 32 | } |
| 33 | return newNode; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Adds new nodes to the tree at the given index. |
no test coverage detected