myxvisual / react-uwp

📱⌨ React Components that Implement Microsoft's UWP Design & Fluent Design.
https://react-uwp.com
MIT License
1.18k stars 78 forks source link

commandbar render failed #74

Closed PitterL closed 5 years ago

PitterL commented 5 years ago

Hi, Myxvisual: I tried to test the example of commandbar, it shows the and couldn't be render out. There is no icons displayed for primaryCommands. And for secondaryCommands, the could come out, but not appears.

==============================================================

Problem description

commandbar example not work.

Link to minimal working code that reproduces the issue

https://www.react-uwp.com/components/commandbar

Versions

PitterL commented 5 years ago

electron 1.8.8 is work for this

PitterL commented 5 years ago

I found the electron boilerplate is not work with , other components are working. Is any any tips for debugging these to components?

Electron Boilerplate:

https://github.com/mjangir/reactron https://github.com/electron-react-boilerplate/electron-react-boilerplate

thanks.

PitterL commented 5 years ago

Hi, Myxvisual: I found there caused the and not created out: when create each primaryCommands elements, there compared the type, when i printed out each elem,

        React.Children.toArray(primaryCommands).filter(
          function (child) { 
            console.log("<CommandBar> child:", child.type, AppBarButton_1.default, child.type == AppBarButton_1.default, child.type == AppBarSeparator_1.default);
            return (child.type === AppBarButton_1.default || child.type === AppBarSeparator_1.default); 
          }
        );

the result show the two function is same but i don't have idea why it's not equal(even use '=='):

child: Æ’ AppBarButtonButton() { return _super !== null && _super.apply(this, arguments) || this; } Æ’ AppBarButtonButton() { return _super !== null && _super.apply(this, arguments) || this; } false false So i temporarily to change the compare variable to child.type.name and AppBarButton_1.default.name: ```js React.Children.toArray(primaryCommands).filter(function (child) { return (child.type.name === AppBarButton_1.default.name || child.type.name === AppBarSeparator_1.default.name); }) ``` Do you know the reason?
PitterL commented 5 years ago

Still found the same issues in SplitView.prototype.render function:

Use function name to determine the component instead:

React.Children.forEach(children, function (child, index) {
                if (child.type.name === SplitViewPane_1.default.name) {
                    splitViewPanes.push(React.cloneElement(child, {
...
myxvisual commented 5 years ago

Hi, @PitterL sorry for delay in reply, I guess your project has multiple node_modules, which causes the referenced js files to be different.

PitterL commented 5 years ago

Actual it is that, the boilerplate use two-package-structure which has get two node_modules https://www.electron.build/tutorials/two-package-structure

Thank you, Myxvisual .