react-uwp
react-uwp copied to clipboard
SplitViewCommand may lose attributes in create
Describe the bug I intend to add onClick event in NavigationView, which uses SplitViewCommand as it children elements. So it will be like this as the examples:
const navigationTopNodes =
items.map(item => {
return <SplitViewCommand icon={item.icon} label={item.label} onClick={()=>{console.log("<NavigatorBar> onClick", item.label)}}/>
});
...
<NavigationView
....
navigationTopNodes={navigationTopNodes}
....
>
<SplitViewPane />
</NavigationView>
But it not working, so i trace the code here in SplitViewCommand:
in SplitViewCommand.prototype.render = function () {
....
return (React.createElement(PseudoClasses_1.default, __assign({}, rootStyleClasses),
React.createElement("div", __assign({}, attributes),
(visited && !isTenFt) ? React.createElement("div", __assign({}, visitedBorderStyleClasses)) : null,
React.createElement(Icon_1.default, __assign({}, iconStyleClasses), icon),
label && (React.createElement("div", __assign({}, labelStyleClasses), label)))));
}:
the "onClick" props set as "rest attributes" ans applied to 2nd level div, I'm not sure what this used, but it not work for the answer the click event. So I tried move the "rest attributes" of the root div, it's working:
return (React.createElement(PseudoClasses_1.default, __assign({attributes}, rootStyleClasses),
React.createElement("div", __assign({}, /*attributes*/{}),
(visited && !isTenFt) ? React.createElement("div", __assign({}, visitedBorderStyleClasses)) : null,
React.createElement(Icon_1.default, __assign({}, iconStyleClasses), icon),
label && (React.createElement("div", __assign({}, labelStyleClasses), label)))));
Expected behavior onClick event working for NavigationView
Desktop (please complete the following information):
- OS: Windows 10
- Browser: "electron": "^4.0.4",
Additional context I also see the onMouseEnter and onMouseLeave props are also not used here?
Thanks.