Skip to content

SplitViewCommand may lose attributes in create #77

Description

@PitterL

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions