-
Notifications
You must be signed in to change notification settings - Fork 605
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
[Navigation Animation] When pressing back twice in succession, the display shows a screen with no comparables #1408
Comments
For
Are you pressing the system back button? Or do you have a button on the screen that is manually calling |
@ianhanniballake I've put the navigation in the previous comment so I'll tell you the rest, apparently I've tried now to press the back button of the system and that way it doesn't seem to reproduce the problem. On the initial screen I simply have a Scaffold with a LazyVerticalGrid, clicking on one of these items navigates to the second screen. The navigation with the second screen is as follows:
Where NavItem and NavArgs is as follows:
In the second screen I have another Scaffold, and in it, inside the TopAppBar, in the navigationIcon button, I call the navigation to perform goBack, which manually calls navController.popBackStack() I hope this information will help you a little more, if not, please do not hesitate to ask me again |
Looks like your click listeners suffer the same problem as #1320, where they are not checking the That alone will always avoid a blank screen, since there would be no way for your The reason you are getting a blank screen is because you are also not following the documentation:
That double tap of the button, without checking the The system back button works because it disables itself as soon as there is only one destination left on the back stack, ensuring that the activity takes the next back button press and closes the activity. |
Based on the above (and #1320), I will summarize that the solution is to check the lifecycle before navigating.
This is a ready-made code snippet for those who come to this topic from Google search. |
Description
By having 2 screens (or more), but in the case of 2, to be simpler, a Main screen, which will be the initial screen, and the second, a Details screen, when being in the details screen, and pressing the back button twice in a row, the navigation goes through the Main screen, and shortly after it will go to another screen without any content, with a black background
Steps to reproduce
Expected behavior
The expected behaviour is that once in the main screen defined as startDestination, it does not go backwards, or in case of going backwards, it exits directly from the application, but does not show an empty screen.
Additional context
Here are the versions of the Compose-related libraries I am currently using:
The text was updated successfully, but these errors were encountered: