Can't unMaximize from Fullscreen macOS using Electron

Hi

I’ve created custom MacOS buttons for my app using React and Electron. The kind of work, however, when you put the app into fullscreen using the ‘green traffic light’ you then can’t take it back to normal.

Source Code: https://sourceb.in/e7db53a61e.jsx

Any ideas why that is?