-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unified safe area (insets) for Android and iOS #23811
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Gregman-js
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
As @jpelgrom said in the linked issue. We need to think about how to handle situation where user have updated android app and old server which do not support new css variables yet... |
b59b4c8
to
2112dfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit concerned by this as var
has a different scope than env
so we have to test it thoroughly
"safe-area-bottom": | ||
"var(--android-safe-area-inset-bottom, env(safe-area-inset-bottom, 0))", | ||
"safe-area-top": | ||
"var(--android-safe-area-inset-top, env(safe-area-inset-top, 0))", | ||
"safe-area-left": | ||
"var(--android-safe-area-inset-left, env(safe-area-inset-left, 0))", | ||
"safe-area-right": | ||
"var(--android-safe-area-inset-right, env(safe-area-inset-right, 0))", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not derived styles, please move it to resources/styles
@@ -154,4 +154,12 @@ export const derivedStyles = { | |||
"material-background-color": "var(--card-background-color)", | |||
"material-secondary-background-color": "var(--secondary-background-color)", | |||
"material-secondary-text-color": "var(--secondary-text-color)", | |||
"safe-area-bottom": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not change the name
"safe-area-bottom": | |
"safe-area-inset-bottom": |
@marcinbauer85 This PR won't fix this. But I think we need to fix this issue before introducing android changes. It is possible to click this button (on screenshot above) with navigation bar, but it can be impossible to do it with 3 button navigation on android if this view does not respect safe area insets. |
Yes please, that would be great! |
Proposed change
I noticed minor differences between embedding WebView in iOS and Android.
![Screenshot 2025-01-20 at 17 18 57](https://private-user-images.githubusercontent.com/39136587/404948341-05946dc6-377b-4698-b363-b0eaebf221fc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MDcyOTUsIm5iZiI6MTczODkwNjk5NSwicGF0aCI6Ii8zOTEzNjU4Ny80MDQ5NDgzNDEtMDU5NDZkYzYtMzc3Yi00Njk4LWIzNjMtYjBlYWViZjIyMWZjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDA1NDMxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBkMmNlOTEyNzMyNTBlMDg3ZGE4NzgyMTdlMTUyMjQ4ZjI3Njc2YmZjNjM4YmJiODZkYTA5OGY3MmE2ZDNlOTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.AnaizSSj9xSgHX2ZBRuIGR4T0INCQXBrunlDSKVzdf4)
Now the webview is not drawn under the navigation bar on Android, but on iOS it is.
I want to resolve part of this issue: draw webview under navigation bar on android.
env
do not work on android, so I prepared another change for android repo to set--android-safe-area-inset-[...]
(variable from this PR) on page load (PR, not required for this PR)In this way, we can unify safe area on ios and android and create even more immersive views.
With these changes, we can also draw webview under status bar on android and iOS (require future work).
Working POC (left iOS, right android):
Type of change
Example configuration
Additional information
When Google will fix
env
support on android webview, we can just change property toenv
First commit: new properties
Second commit: I've replaced all occurence of
env
in code for new propertiesChecklist
If user exposed functionality or configuration variables are added/changed: