Wails: React template error in Windows

Created on 2 Jul 2019  路  2Comments  路  Source: wailsapp/wails

Description
The main graphics are offset vertically and when the button is clicked, there is a script error.

To Reproduce
Steps to reproduce the behaviour:

  1. Generate a React project
  2. Click the button

Expected behaviour
It should work like on Mac and Linux

Windows bug

Most helpful comment

I had a look at that isssue:

  1. There is indeed a vertical offset on Windows 10, I suspect due to the system's top bar being counted as part of the view port. One potential fix would be to add this offset on the config's height property in here for Windows only. https://github.com/wailsapp/wails/blob/7dd42f964b4998323668a17cddd64ecd11a67190/renderer_webview.go#L40

  2. The script error is due to MSHTML (Windows webview) not supporting Promises which are used in the template in here: https://github.com/wailsapp/wails/blob/7dd42f964b4998323668a17cddd64ecd11a67190/cmd/templates/create-react-app/frontend/src/components/HelloWorld.js#L18
    An easy fix would be to add this polyfill https://www.npmjs.com/package/core-js to the template's package.json and import it in the template's entrypoint.

Happy to send a PR for both issues if you think those fixes are good to go.

All 2 comments

I had a look at that isssue:

  1. There is indeed a vertical offset on Windows 10, I suspect due to the system's top bar being counted as part of the view port. One potential fix would be to add this offset on the config's height property in here for Windows only. https://github.com/wailsapp/wails/blob/7dd42f964b4998323668a17cddd64ecd11a67190/renderer_webview.go#L40

  2. The script error is due to MSHTML (Windows webview) not supporting Promises which are used in the template in here: https://github.com/wailsapp/wails/blob/7dd42f964b4998323668a17cddd64ecd11a67190/cmd/templates/create-react-app/frontend/src/components/HelloWorld.js#L18
    An easy fix would be to add this polyfill https://www.npmjs.com/package/core-js to the template's package.json and import it in the template's entrypoint.

Happy to send a PR for both issues if you think those fixes are good to go.

Thanks for spending time looking at this! I'm guessing that the offset bug is in the underlying WebView library. We could definitely add the fix, if it works. Let us know.
Nice catch on the promises. We do install this polyfill for the vuetify template so I'm good with this solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

incafox picture incafox  路  7Comments

Lyimmi picture Lyimmi  路  4Comments

ewhal picture ewhal  路  3Comments

best2000 picture best2000  路  7Comments

leaanthony picture leaanthony  路  3Comments