electron-with-create-react-app icon indicating copy to clipboard operation
electron-with-create-react-app copied to clipboard

Can't get click event to register at all in desktop app... works in the browser

Open dascoder opened this issue 6 years ago • 2 comments

Running Electron + react set up according to your guide here. I added a simple app bar from material and created a react class from the component.

However the components in the window launched by electron.exe are not responsive. If I go to localhost:3000 then I find that the buttons are responsive and trigger events, everything works!

Any tips to help me investigate?

dascoder avatar Feb 21 '19 22:02 dascoder

I don't know. If I add this to App.js, I see the messages in the console.

<button onClick={()=>{console.log("Button Pressed")}}>
          Push me
</button>

I would start with simple buttons. There may be an issue with material-ui, but that unfortunately might mean debugging that side of things.

csepulv avatar Feb 22 '19 00:02 csepulv

Interesting. I've removed material and tried the same experiment. in the component constructor this.toggleWindowVisibility = this.toggleWindowVisibility.bind(this)

the function

toggleWindowVisibility(){ 
  if (document.visibilityState === "visible")
  {
    log.info("Clicked minimize!")
    window.dispatchEvent(new Event('minimize'))
    return
  }
  log.info("Window is not visible")
  window.moveTo(0,0);
}

In the render function <button onClick={this.toggleWindowVisibility}}> Push me </button>

still no event triggered.

dascoder avatar Feb 22 '19 18:02 dascoder