Assigned
Status Update
Comments
gr...@google.com <gr...@google.com> #2
This actually has nothing to do with NavHostFragment, but is the behavior of NavController's setGraph().
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
Description
Jetpack Compose BOM version: 2025.02.00
Jetpack Compose component(s) used:
Kotlin version: 2.0
Steps to Reproduce
Show a DropdownMenu at the very top or bottom of the screen.
Expected result:
Popups are shown at the very top of bottom of the screen.
Actual result:
Code Sample to Reproduce:
Additional information
Issues from hardcoded padding were reported 3 years ago -https://github.com/JetBrains/compose-multiplatform/issues/1831