-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ComposeUiViewController with nested scrollable column shrinks Column with UIModalPresentationFormSheet #4850
Comments
any updates on this issue? |
I'll have a look at it soon. |
The nested scrolling issue is a separate one: |
But is the scrolling issue related to the shrinking/stretching of the content? |
Not really |
Memory warning doesn't seem to be related to the repro you posted. Most likely you have a retain cycle between Kotlin and ObjC with a strong reference inside ObjC API that Kotlin can't break. |
@elijah-semyonov I dont really see how could that be the case as the prototype app I used to reproduce the bug uses the standard architecture of a multiplatform app where I simply use a ComposeUIViewController from swift, and to this view controller I add the sample code above |
Do you mind sharing the whole solution? |
all I do to trigger the memory warning is attempt to scroll inside the column in my bottom sheet by scrolling multiple times consecutively. this actually does scroll inside my column but at an extremely slow pace as in every scroll event scrolls the column by 1 pixel roughly |
Can you record it? I fail to reproduce this behavior. |
sure ill record it right now |
Here's the repo containing the reproduction code: RPReplay_Final1717579567.MOV![]() |
@nilufer32 |
Reproduced memory spike though |
the issue is 100% reproducible using compose 1.6.10 and kotlin 2.0.0. I just seem to have forgotten to update the library versions when I was creating a sample app to post for you onto github :) |
A |
Since `owner.size` doesn't really observed during composition setting scene size might not trigger invalidations - Manually run `updateRootConstraints` instead of marking size as state - Pick extra conditions from [aosp/2598886](https://android-review.googlesource.com/c/platform/frameworks/support/+/2598886) Fixes stretching reported in JetBrains/compose-multiplatform#4850 ## Testing Run `MultiLayerComposeSceneTest` ## Release Notes ### Fixes - iOS - Fix missing invalidations during native view resize
Explicitly manage lifetime of metal drawables by hiding them from Kotlin runtime. Fixes a memory spike when quickly resizing metal layer as in a scenario reported in [the issue](JetBrains/compose-multiplatform#4850) Otherwise associated drawable pools are retained until next GC, which can happen after inadequate amount of drawables with new sizes are allocated ### Before: <img width="414" alt="Screenshot 2024-06-06 at 13 33 46" src="https://github.com/JetBrains/compose-multiplatform-core/assets/4167681/81d74dfe-91c0-4362-ad71-93416dbe172f"> ### After: <img width="574" alt="Screenshot 2024-06-07 at 10 04 18" src="https://github.com/JetBrains/compose-multiplatform-core/assets/4167681/6574b297-1e81-48db-9aee-d31c2425267c"> ## Testing Resize the popup with `ComposeUIViewController` to different detents inside Demo `IosBugs/PopupStretching` Requires either patch: ``` Index: compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt b/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt --- a/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt (revision 39d436a) +++ b/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt (date 1717747754590) @@ -558,6 +558,7 @@ asDpRect().toRect() } } + onComposeSceneInvalidate() scene.size = IntSize( width = boundsInPx.width.roundToInt(), height = boundsInPx.height.roundToInt() ``` Or #1387 ## Release Notes ### iOS - Fixes - Fixed a memory spike when continuously resizing the `ComposeUIViewController` (such as when used in modal sheet presentation context with different detents)
Describe the bug
A clear and concise description of what the bug is.
When using ComposeUiViewController, and setting the modalPresentationStyle of the view controller to UIModalPresentationFormSheet, dragging the form sheet updwards/downwards causes shrinking/stretching of the nested composable scrollable column I place inside it. Also im not able to vertically scroll my column.
Affected platforms
IOS
Versions
To reproduce:
Video depicting the bug :
Screen.Recording.2024-05-22.at.7.33.37.PM.mov
Additional Warning:
When attempting to scroll in my nested vertically scrollable column, I receive the following logs in Xcode:
DidReceiveMemoryWarning
The text was updated successfully, but these errors were encountered: