Black window frame during electron start when BrowserWindow.maximize() is used

#1

If I start my app maximized using BrowserWindow.maximize(), for example, using the electron-quick-start, I see a black frame (or black rectangle) for some seconds before the rest of the app loads and the frame goes away.

I do not see this when the app does not start maximized.

I am using Windows 10 1709. Anybody else seeing this? Does anybody knows how to remove it?

Thanks.

0 Likes

#2

i see this too. don’t have idea what will be the cause.
however, this can be workaround/solution.

firstly, you create window with show:false, then you wait for ready-to-show event to let it maximize.

mainWindow = new BrowserWindow({show: false})
 mainWindow.on('ready-to-show', ()=>{
    mainWindow.maximize();
  })
1 Like

#3

It works, but now now fully black window appears for short however visible time before ready-to-show fired.
Any idea how to avoid of this?

0 Likes

#4

I fixed issue with below code .
setTimeout(() => {
mainWindow.maximize();
}, 600);

0 Likes

#5

One more way i found and this is workaround .Create window with show:false and after maximize mainWindow.show();

0 Likes