KochiyaOcean / electron-react-titlebar

A github desktop style title bar component for electron.
MIT License
60 stars 15 forks source link

Incompatible with electron 14 #21

Closed vraravam closed 3 years ago

vraravam commented 3 years ago

Thanks for the useful library. Unfortunately, we are unable to upgrade to electron-14 due to the following bug. This appears in our console. Uncaught TypeError: Cannot read properties of undefined (reading 'getCurrentWindow')

The error appears to occur here: electron-react-titlebar/lib/window-controls.js:78 according to the firebug console.

We are using 0.8.2 of this package.

If you have a fix, I would be glad to test it out in our codebase. TIA!

KochiyaOcean commented 3 years ago

It's due to electron has removed remote module since 14. I'll try to find a solution to workaround with, but it might be a breaking change

vraravam commented 3 years ago

In this line if you can make it null, and all over the code, if that value is set, then use it, that might be enough to unblock me. TIA

KochiyaOcean commented 3 years ago

Hello, I've published the new version v1.0.0 and the issue should be resolved. Please have a try and tell me if you feel there is somewhere needs improvements.

vraravam commented 3 years ago

hi @KochiyaOcean - thanks for the quick response. I tried with v1.0.0, but this is the error that I now get:

No "exports" main defined in xxxxx/ferdi/node_modules/electron-react-titlebar/package.json

I have followed the instructions in the README, and my commit is here

KochiyaOcean commented 3 years ago

@vraravam You also need to change the import path in renderer process, which should be changed to electron-react-titlebar/renderer

vraravam commented 3 years ago

Thanks @KochiyaOcean - that fixed it!!! 🎉