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

When navigate from one screen to another screen, the new screen show the previous screen as an image above the root view in the compose screen #6

Open
AlaaEddinAlbarghoth opened this issue Jan 8, 2023 · 7 comments

Comments

@AlaaEddinAlbarghoth
Copy link

AlaaEddinAlbarghoth commented Jan 8, 2023

  • Library Version [e.g. v0.1.1]
  • All devices

The issue
I put Cloudy() above the column I used in Screen B, but when navigating from Screen A to Screen B, the previous screen A is showing in screen B

Expected Behavior:
You can navigate to the new screen and you can see the views and compostables of new screen B

@skydoves
Copy link
Owner

skydoves commented Jan 9, 2023

Hey, thanks for reporting the issue. Which way do you use for navigating screens?

@AlaaEddinAlbarghoth
Copy link
Author

@AlaaEddinAlbarghoth
Copy link
Author

Hello @skydoves, Do you have updates on this issue?

@skydoves
Copy link
Owner

@AlaaEddinAlbarghoth Sorry for the late response. Could you give key1 on your Cloudy composable like the example below?

Cloudy(
  radius = 15,
  key1 = (an object that indicates navigation screen, which must differ depending on your screen)
) {
  ...
}

@carlospinia
Copy link

carlospinia commented Mar 29, 2023

Same issue here. I have been trying things out. Seeing your comment above, I tried adding a state change via a delay and it works, but during the delay you still see the previous screen in the Cloudy container.

val coroutineScope = rememberCoroutineScope()
var state by remember { mutableStateOf(0) }
LaunchedEffect(key1 = Unit) {
        coroutineScope.launch {
                delay(200)
                state = 1
        }
}
Cloudy(radius = 25, key1 = state) {
   ...
}

@skydoves skydoves reopened this Mar 29, 2023
@nubpro
Copy link

nubpro commented Jun 19, 2023

@skydoves Is there a simple and elegant way to go about this?

@marcopla99
Copy link

marcopla99 commented Dec 22, 2023

It's quite tricky to fix this issue from Cloudy because the blur is applied to a Bitmap generated from the View with a PixelCopy request on the Window. When navigating, the old screen is still visible for a few milliseconds due to the navigation animation. PixelCopy will start generating the Bitmap as soon as the navigation starts, causing the old blurred View to be shown.

One workaround to this is disabling navigation animations from your NavHost or your screen composables (only from version 2.7.0 of androidx.navigation:navigation-compose):
NavHost( navController = navController, startDestination = "home", enterTransition = { EnterTransition.None }, exitTransition = { ExitTransition.None } ) { /* ... */ }

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

No branches or pull requests

5 participants