You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`data`|[TreeNode](#treenode)| Yes | An array of `TreeNode` objects |
121
-
|`onCheck`|`(checkedIds: string[], indeterminateIds: string[]) => void`| No | Callback when a checkbox state changes |
122
-
|`onExpand`|`(expandedIds: string[]) => void`| No | Callback when a node is expanded |
123
-
|`preselectedIds`|`string[]`| No | An array of `id`s that should be pre-selected |
124
-
|`preExpandedIds`|`string[]`| No | An array of `id`s that should be pre-expanded |
124
+
|`data`|[TreeNode](#treenode)`<ID = string>[]`| Yes | An array of `TreeNode` objects |
125
+
|`onCheck`|`(checkedIds: ID[], indeterminateIds: ID[]) => void`| No | Callback when a checkbox state changes |
126
+
|`onExpand`|`(expandedIds: ID[]) => void`| No | Callback when a node is expanded |
127
+
|`preselectedIds`|`ID[]`| No | An array of `id`s that should be pre-selected |
128
+
|`preExpandedIds`|`ID[]`| No | An array of `id`s that should be pre-expanded |
125
129
|`selectionPropagation`|[SelectionPropagation](#selectionpropagation)| No | Control Selection Propagation Behavior. Choose whether you want to auto-select children or parents. |
130
+
|`initialScrollNodeID`|`ID`| No | Set node ID to scroll to intiially on tree view render. |
126
131
|`indentationMultiplier`|`number`| No | Indentation (`marginStart`) per level (defaults to 15) |
127
132
|`treeFlashListProps`|[TreeFlatListProps](#treeflatlistprops)| No | Props for the flash list |
128
133
|`checkBoxViewStyleProps`|[BuiltInCheckBoxViewStyleProps](#builtincheckboxviewstyleprops)| No | Props for the checkbox view |
129
134
|`CheckboxComponent`|`ComponentType<`[CheckBoxViewProps](#checkboxviewprops)`>`| No | A custom checkbox component. Defaults to React Native Paper's Checkbox |
130
135
|`ExpandCollapseIconComponent`|`ComponentType<`[ExpandIconProps](#expandiconprops)`>`| No | A custom expand/collapse icon component |
131
136
|`ExpandCollapseTouchableComponent`|`ComponentType<`[TouchableOpacityProps](https://reactnative.dev/docs/touchableopacity#props)`>`| No | A custom expand/collapse touchable component |
132
-
|`CustomNodeRowComponent`|`React.ComponentType<`[NodeRowProps](#noderowprops)`>`| No | Custom row item component |
133
-
134
-
ℹ️ If `CustomNodeRowComponent` is provided then below props are not applied:
135
-
136
-
1.`indentationMultiplier`
137
-
2.`checkBoxViewStyleProps`
138
-
3.`CheckboxComponent`
139
-
4.`ExpandCollapseIconComponent`
140
-
5.`ExpandCollapseTouchableComponent`.
141
-
142
-
⚠️ If the tree view doesn't scroll if rendered in a complex nested scroll view/s then try setting the `renderScrollComponent` value in `treeFlashListProps` to `ScrollView` from `react-native-gesture-handler`.
137
+
|`CustomNodeRowComponent`|`React.ComponentType<`[NodeRowProps](#noderowprops)`<ID>>`| No | Custom row item component |
138
+
139
+
##### Notes
140
+
141
+
- The `ID` type parameter allows flexibility in specifying the type of node identifiers (e.g., `string`, `number`, or custom types).
142
+
- ℹ️ If `CustomNodeRowComponent` is provided then below props are not applied:
143
+
1.`indentationMultiplier`
144
+
1.`checkBoxViewStyleProps`
145
+
1.`CheckboxComponent`
146
+
1.`BuiltInCheckBoxViewStyleProps`
147
+
1.`ExpandCollapseIconComponent`
148
+
1.`ExpandCollapseTouchableComponent`.
149
+
150
+
- ⚠️ If the tree view doesn't scroll if rendered in a complex nested scroll view/s then try setting the `renderScrollComponent` value in `treeFlashListProps` to `ScrollView` from `react-native-gesture-handler`.
143
151
144
152
---
145
153
146
-
#### TreeNode
154
+
#### TreeNode`<ID = string>`
155
+
156
+
*The `TreeNode` interface defines the properties for individual item of the tree view*
|`setSearchText`|`(searchText: string, searchKeys?: string[]) => void`| Set the search text and optionally the search keys. Default search key is "name"<br /><br />Recommended to call this inside a debounced function if you find any performance issue otherwise. |
184
+
|`scrollToNodeID`|`(params: `[ScrollToNodeParams](#scrolltonodeparams)`<ID>) => void;`| Scrolls the tree view to the node of the specified ID. |
185
+
|`getChildToParentMap`|`() => Map<ID, ID>`| Get the child to parent tree view map. |
|`toChildren`|`boolean`| No | Whether to propagate selection to children nodes. Defaults to `true`. |
@@ -183,12 +209,14 @@ export function TreeViewUsageExample(){
183
209
184
210
#### TreeFlatListProps
185
211
186
-
All properties of `FlashListProps`(from `@shopify/flash-list`) except for `data` and `renderItem`
212
+
*All properties of `FlashListProps`(from `@shopify/flash-list`) except for `data` and `renderItem`*
187
213
188
214
---
189
215
190
216
#### BuiltInCheckBoxViewStyleProps
191
217
218
+
*This interface allows you to customize the style of the built-in checkbox component that is rendered in the tree view by default. Overriden if `CustomNodeRowComponent` is used.*
0 commit comments