react-native-tree-multi-select
Version:
Super-fast, customizable tree view component for React Native with drag-and-drop reordering, multi-selection, and search filtering.
27 lines • 1.34 kB
TypeScript
import type { TreeNode } from "../types/treeView.types";
/**
* Initialize the maps for tracking tree nodes and their parent-child relationships.
*
* This function is intended to be called once, during component initialization,
* with the initial tree data and any preselected node IDs.
*
* @param storeId - Identifier for the specific tree view store.
* @param initialData - An array of TreeNode objects that represent the initial tree structure.
*/
export declare function initializeNodeMaps<ID>(storeId: string, initialData: TreeNode<ID>[]): void;
/**
* Compute the maximum depth of a node's subtree (0 for a leaf node).
* Uses an iterative stack-based DFS to avoid call-stack limits on deep trees.
*
* @param nodeMap - Map of node ID to node (from `initializeNodeMaps`).
* @param nodeId - The root of the subtree to measure.
*/
export declare function getSubtreeDepthFromMap<ID>(nodeMap: Map<ID, TreeNode<ID>>, nodeId: ID): number;
/**
* Compute a node's depth (its level, 0 for root) by walking the child-to-parent map.
*
* @param childToParentMap - Map of child ID to parent ID (from `initializeNodeMaps`).
* @param nodeId - The node whose depth to compute.
*/
export declare function getNodeDepthFromParentMap<ID>(childToParentMap: Map<ID, ID>, nodeId: ID): number;
//# sourceMappingURL=treeNode.helper.d.ts.map