Nikolai Sviridov
09/03/2021, 11:14 AM...
import TreeView from '@material-ui/lab/TreeView';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
...
<TreeView
defaultCollapseIcon={<ExpandMoreIcon />}
>
...
Wrappers for TreeView and ExpandMoreIcon exists, but how to recreate defaultCollapseIcon={<ExpandMoreIcon />} ?Big Chungus
09/03/2021, 11:32 AMclass ExpandMoreIcon: RClass<ExpandMoreIconProps>Nikolai Sviridov
09/03/2021, 12:04 PMclass in your case, but my wrapper looks like this
@file:JsModule("@material-ui/icons/ExpandMore")
@file:JsNonModule
package wrappers.materialui
import react.ComponentClass
import react.PropsWithChildren
@JsName("default")
external val ExpandMoreIcon: ComponentClass<PropsWithChildren>
RClass is deprecated and now it's typeallias for ComponentClass . And my question is how to properly to pass it to props?
``````Nikolai Sviridov
09/03/2021, 12:07 PM...
TreeView {
attrs {
defaultExpandIcon = /* what we need here ? */
}
...
}Big Chungus
09/03/2021, 12:08 PMExpandMoreIcon(props)Nikolai Sviridov
09/03/2021, 12:22 PMExpandMoreIcon {} and in case
defaultExpandIcon = ExpandMpreIcon {}
I'm getting error:
Objects are not valid as a React child (found: object with keys {}). If you meant to render a collection of children, use an array instead.
But if I pass it as arrayOf(ExpandMoreIcon {} ) It just renders icon on top of all view (not in place where it needs to be) and doesn't change.Big Chungus
09/03/2021, 12:24 PMExpandMpreIcon {} is incorrect, because it just attaches the component to your parent component (not TreeView)Nikolai Sviridov
09/03/2021, 12:34 PMExpandMoreIcons(props) ? ExpandMoreIcons(jsObject()) gives me another error
handler is not a functionBig Chungus
09/03/2021, 1:17 PMandylamax
09/03/2021, 3:14 PMTreeView {
attrs {
defaultExpandIcon = createElement(ExpandMoreIcon)
}
}Nikolai Sviridov
09/03/2021, 3:46 PMturansky
12/15/2021, 5:44 PMpre.280 :
val App = FC<Props>("App") {
TreeView {
defaultExpandIcon = ExpandMoreIcon.create()
}
}