Hi, I am struggling to access mui props from TreeV...
# react
s
Hi, I am struggling to access mui props from TreeViewPropsBase, can someone help me with the syntax, I want to access all the props available in the attached screenshot.
_TreeView_ *{*
// Tree view props here
_treeItemComponent_(props.groups)
}
fun ChildrenBuilder.treeItemComponent(data: FacilityGroupsDataClass): Unit = _TreeItem_ *{*
nodeId = data.groupId.toString()
label = _ReactNode_(data.groupName)
expandIcon =
_ExpandMore_._create_()
collapseIcon =
_ExpandLess_._create_()
data.childGroups?.
_forEach_ *{* child *->*
_treeItemComponent_(child)
}
}
t
Copy code
TreeView {
    // Here you need to write props, not read
}
s
@turansky I am not able to access any props for TreeView ( Intellij is not recognizing them and I am getting compilation errors), I see TreeViewProps implements react.Props, however all the required props are in TreeViewPropsBase interface, can you please show me how I can implement expanded prop and onNodeFocus callback ?
_TreeView_ *{*
onNodeFocus = *{*
}
_treeItemComponent_(props.groups)
}
t
cc @aerialist
a
Hi @Salman, I reproduced it. It is a bug, will fix it thanks. Here is a WA for you
Copy code
TreeView {
    @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
    this as TreeViewPropsBase

    onNodeFocus = { _, _ ->
        console.log("Hello!")
    }
}
s
okay, thanks
l
Yes, thanks for the WA @aerialist. The bug still seems to be in the kotlin-wrappers 1.0.0-pre.628. The following won't compile without it.
Copy code
TreeView {
            TreeItem {