tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.2k stars 2.42k forks source link

[bug] windowconfig 'transparent' causes white screen on android, it should not do anything on android #9408

Closed n251256 closed 3 months ago

n251256 commented 4 months ago

Describe the bug

In V2, setting transparent to true in the WindowConfig will cause a white screen on android, this is not supposed to do anything on android.

Reproduction

  1. Make a new Tauri project using V2.
  2. Set transparent to true in WindowConfig.
  3. Run tauri android dev. (its the same when built)
  4. You will see a white screen, if you turn transparent off and run dev again it will work.

Expected behavior

I expect Tauri to automatically turn transparent off on mobile devices.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 123.0.2420.81
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.77.0 (aedd173a2 2024-03-17)
    ✔ cargo: 1.77.0 (3fe68eabf 2024-02-29)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.11.1
    - pnpm: 8.15.6
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.13
    - tauri-build [RUST]: 2.0.0-beta.10
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.2
    - @tauri-apps/api [NPM]: 2.0.0-beta.6
    - @tauri-apps/cli [NPM]: 2.0.0-beta.11

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

simonhyll in the Tauri discord server told me it was a bug and to make a bug report

AClon314 commented 4 months ago

same issue, and you can't use rust code window.transparent(true) after window is built:

tauri::Builder::default()
        .setup(|app| {
            let get_window = app.get_webview_window("main").unwrap();
            #[cfg(debug_assertions)]
            {
                get_window.open_devtools();
            }
            #[cfg(desktop)]
            {
                get_window.transparent(true);
            }
            Ok(())
        })

which you would got:

error[E0599]: no method named `transparent` found for struct `tauri::WebviewWindow` in the current scope
  --> src\lib.rs:20:28
   |
20 |                 get_window.transparent(true);
   |                            ^^^^^^^^^^^ method not found in `WebviewWindow`