tobspr / cordova-plugin-android-notch

Plugin to query android notch insets
MIT License
19 stars 13 forks source link

Question : set css safe-area-inset-top #3

Open Aarbel opened 5 years ago

Aarbel commented 5 years ago

Hi @tobspr , thank you for this plugin !

Instead of using custom css variable, can it set safe-area-inset instead ?

In my case i set StatusBar.overlaysWebView(true), but Android doesn't set a safe-area-inset-top (i didn't installed youe plugin, i just want to make my app full screen, i also don't want to use an other variable than safe-area-insets to don't overload 40 files of my css)

tobspr commented 5 years ago

I'm not entirely sure if this works, since on ios you do constant(safe-are-inset-XXX) whereas with a custom variable you do var(my-variable). Correct me if I am wrong, but I don't think this is possible rn (Sorry for the slow response btw)

tobspr commented 5 years ago

I updated the readme with a scss snippet which takes care of managing all variables. Does this work out for you?

Aarbel commented 5 years ago

safe-are-inset-XXX can be directly used in css like env(safe-are-inset-XXX).

Could be great to use the same with your plugin

tobspr commented 5 years ago

Correct me if I am wrong, but you can not set env() variables right now. Or am I misinformed on that? I.e. it would be great if we could just set the safe-area-inset-top environment variable but I don't think thats possible right now.

https://developer.mozilla.org/en-US/docs/Web/CSS/env

Which is why we have to use var()

Aarbel commented 5 years ago

I think you should natively set it so that the native webview viewport of cordova can directly use env(safe-area-inset-XXXX) https://developer.android.com/guide/topics/display-cutout?authuser=2 https://proandroiddev.com/making-notch-friendly-apps-for-android-75776272be5c

Aarbel commented 5 years ago

After 30 minutes of research, the way on android to natively set safe-area-inset env from WindowInsets.getDisplayCutout() to native webview is not very well documented, so surely advanced api to talk about with android teams

tafelnl commented 6 months ago

After 30 minutes of research, the way on android to natively set safe-area-inset env from WindowInsets.getDisplayCutout() to native webview is not very well documented, so surely advanced api to talk about with android teams

Sorry to bump this. But did you ever figure out if there is a way to do this, and if yes how?

Aarbel commented 6 months ago

@tafelnl i don't remember, otherwise it created these two tickets:

For now i don't know how safe-area variables are set