Skip to content
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

Black screens with UIKitView after navigating away and navigating back on 1.5.10-beta02 #3749

Closed
ToluwaniO opened this issue Sep 29, 2023 · 7 comments · Fixed by JetBrains/compose-multiplatform-core#857
Assignees
Labels

Comments

@ToluwaniO
Copy link

ToluwaniO commented Sep 29, 2023

Describe the bug
After upgrading to 1.5.10-beta02, I'm encountering issues with UIKitView when I navigate to a new screen and navigate back. I have a UIImageView inside the UIKitView that turns black.

The screens are SwiftUI and the content is compose. Navigation is done at the SwiftUI layer.

Affected platforms
Select one of the platforms below:

  • iOS

If the bug is Android-only, report it in the Jetpack Compose tracker

Versions

  • Kotlin version*: 1.9.0
  • Compose Multiplatform version*: 1.5.10-beta02
  • OS version(s)* (required for Desktop and iOS issues): iOS 16.6
  • OS architecture (x86 or arm64):
  • JDK (for desktop issues):

Expected behavior
No black screens after navigation

Screenshots

RPReplay_Final1695999871.1.mp4

Additional context

@OptIn(ExperimentalForeignApi::class)
@Composable
actual fun NetworkImageImpl(
    modifier: Modifier,
    url: String?,
    contentDescription: String?,
    contentScale: ContentScale,
    usePlatform: Boolean
) {
    val imageLoader = LocalNetworkImageLoader.current
    UIKitView(
        modifier = modifier,
        background = Color.Transparent,
        factory = {
            UIImageView()
        },
        update = {
            when (contentScale) {
                ContentScale.Crop -> {
                    it.contentMode = UIViewContentMode.UIViewContentModeScaleAspectFill
                    it.clipsToBounds = true
                }
                ContentScale.Fit -> {
                    it.contentMode = UIViewContentMode.UIViewContentModeScaleAspectFit
                }
            }
            if (url != null) {
                imageLoader.loadUrlIntoImage(it, url)
            }
        },
        onRelease = {
                    Napier.d("image released", tag = "NetworkImageImpl")
        },
        interactive = false
    )
}

@ToluwaniO ToluwaniO added bug Something isn't working submitted labels Sep 29, 2023
@elijah-semyonov
Copy link
Contributor

elijah-semyonov commented Sep 29, 2023

Hi! Can you reproduce this in Compose 1.4.*?
Is imageLoader.loadUrlIntoImage(it, url) called on second appearance?
Can you show UI debug hierarchy in Xcode?

@eymar
Copy link
Collaborator

eymar commented Sep 29, 2023

After upgrading to 1.5.10-beta02

What was the previous version you used which didn't have an issue?

@ToluwaniO
Copy link
Author

I added logs for loadUrlIntoImage, it gets called when I open the screen for the first time and when I navigate away and come back. I also see that onRelease gets called when I navigate back.

@ToluwaniO
Copy link
Author

After upgrading to 1.5.10-beta02

What was the previous version you used which didn't have an issue?

1.5.10-beta01 works normally @eymar

@ToluwaniO
Copy link
Author

Hi! Can you reproduce this in Compose 1.4.*? Is imageLoader.loadUrlIntoImage(it, url) called on second appearance? Can you show UI debug hierarchy in Xcode?

I can't downgrade to 1.4.* because my app uses features like modal bottom sheet

@elijah-semyonov
Copy link
Contributor

elijah-semyonov commented Oct 2, 2023

Should be fixed in the next release after JetBrains/compose-multiplatform-core#857 is merged.

@ToluwaniO
Copy link
Author

Gotcha, thanks! I'll drop an update if I encounter any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants