-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
iOS: Expanded ModalBottomSheet: semi-transparent black background doesn't occupy complete screen. #3701
iOS: Expanded ModalBottomSheet: semi-transparent black background doesn't occupy complete screen. #3701
Comments
It looks like combination of two issues. The first obvious part is wrong usage of insets (safe-area) inside But the second part is the current way that Screen_recording_20230918_134958.mp4
So, it kinda already works like Android 😄 |
I was able to reproduce what you told for Android. It happens only when we draw content outside safe area, not otherwise. So, is this issue in iOS dependent on the issue in original |
Yep, it was what I meant
Partially. Currently on iOS there is additional problem - it applies safe area incorrectly on low-level component (Popup). I'm investigating this problem |
## Proposed Changes - Apply more insets in `RootLayout` without assuming that it will be centered - Center relatively content area instead of screen (matches Android now) Test | Before | After --- | --- | --- `Popup` / max size / zero offset | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/a3bfef0f-002c-4dab-ad85-58f4a8e88060" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/ec8dd32c-f12b-4e5b-a987-00631678d24c" height="600"> `Dialog` / max size / center | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/ce216f77-5be4-43fa-ae78-df666ee96517" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/8e9820b4-99cd-44a1-80fc-68d7b4887b53" height="600"> ## Testing Test: run mpp on iOS or try to use maximized `Popup` on device with safe-area ## Issues Fixed Fixes (partially) JetBrains/compose-multiplatform#3701
## Proposed Changes - Apply more insets in `RootLayout` without assuming that it will be centered - Center relatively content area instead of screen (matches Android now) Test | Before | After --- | --- | --- `Popup` / max size / zero offset | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/a3bfef0f-002c-4dab-ad85-58f4a8e88060" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/ec8dd32c-f12b-4e5b-a987-00631678d24c" height="600"> `Dialog` / max size / center | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/ce216f77-5be4-43fa-ae78-df666ee96517" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/8e9820b4-99cd-44a1-80fc-68d7b4887b53" height="600"> ## Testing Test: run mpp on iOS or try to use maximized `Popup` on device with safe-area ## Issues Fixed Fixes (partially) JetBrains/compose-multiplatform#3701
## Proposed Changes - Unwrap unnecessary state for `LocalSafeArea`/`LocalLayoutMargins` - Override `LocalSafeArea`/`LocalLayoutMargins` for separate owners. - Replace `IOSInsets` to `PlatformInsets` - [Don't use data classes in an API](https://kotlinlang.org/docs/jvm-api-guidelines-backward-compatibility.html#don-t-use-data-classes-in-an-api) ## Changes in API ```diff -androidx.compose.ui.uikit.IOSInsets +androidx.compose.ui.platform.PlatformInsets ``` ```diff -androidx.compose.ui.uikit.LocalSafeAreaState +androidx.compose.ui.platform.LocalSafeArea ``` ```diff -androidx.compose.ui.uikit.LocalLayoutMarginsState +androidx.compose.ui.platform.LocalLayoutMargins ``` ## Testing ```kt Box(modifier = Modifier .fillMaxSize() .windowInsetsPadding(WindowInsets.systemBars) .background(Color.Green) ) Popup { Box(modifier = Modifier .fillMaxSize() .windowInsetsPadding(WindowInsets.systemBars) .background(Color.Red) ) } ``` Android | iOS (Before) | iOS (After) --- | --- | --- <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/8fe492a6-007e-4cbf-9c8a-fa6eea9bb056" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/3168efba-0072-47aa-853a-1c44bd68e4e0" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/3845efe8-eb8e-4c71-87e2-ea44dd73a91e" height="600"> ## Issues Fixed Fixes (partially) JetBrains/compose-multiplatform#3701
## Proposed Changes - Position `ModalBottomSheet` not relative to parent - Exclude default `Popup`'s insets Before | After --- | --- <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/fe7b4b1b-8c12-49d7-9f4c-9c72af6d05cd" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/176a56ec-9469-4603-b0e8-153fa6c9318a" height="600"> ## Testing Test: run mpp on iOS or try to use `ModalBottomSheetPopup` on device with safe-area ## Issues Fixed Fixes JetBrains/compose-multiplatform#3701, JetBrains/compose-multiplatform#3703
## Proposed Changes - Position `ModalBottomSheet` not relative to parent - Exclude default `Popup`'s insets Before | After --- | --- <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/fe7b4b1b-8c12-49d7-9f4c-9c72af6d05cd" height="600"> | <img src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/176a56ec-9469-4603-b0e8-153fa6c9318a" height="600"> ## Testing Test: run mpp on iOS or try to use `ModalBottomSheetPopup` on device with safe-area ## Issues Fixed Fixes JetBrains/compose-multiplatform#3701, JetBrains/compose-multiplatform#3703
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
Describe the bug
In iOS, when ModalBottomSheet is expanded the semi transparent black background doesn't occupy complete screen.
Affected platforms
Select one of the platforms below:
Versions
To Reproduce
Steps and/or the code snippet to reproduce the behavior:
Using the above following Compose version, implement a ModelBottomSheet and make sure it doesn't fill entire height of screen. (Either set a max height or have a content which doesn't fill whole height.)
Expected behavior
That semi-transparent black bacground should fill the entire screen just like how it works in Android.
The text was updated successfully, but these errors were encountered: