Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SplitViewCommand may lose attributes in create #77

Open
PitterL opened this issue Mar 17, 2019 · 0 comments
Open

SplitViewCommand may lose attributes in create #77

PitterL opened this issue Mar 17, 2019 · 0 comments
Assignees

Comments

@PitterL
Copy link

PitterL commented Mar 17, 2019

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.

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

No branches or pull requests

2 participants