Assigned
Status Update
Comments
ap...@google.com <ap...@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
A
LayoutModifierNode
that delegates to aLayoutModifierNode
cannot easily delegate the measurement / placement logic, which makes it difficult to build complex nodes. This makes it easy to accidentally break things if you addLayoutModifierNode
to a delegating node that already delegated to aLayoutModifierNode
.Similarly, it is also unsupported to delegate to multiplehttps://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatingNode.kt;l=187
LayoutModifierNode
s if the delegating node is not also aLayoutModifierNode
.We discussed that we might be able to provide some API like:
fun LayoutModifierNode.then(DelegatableNode): LayoutModifierNode
To allow for limited control over multiple
LayoutModifierNode
s, where you just control the layout order as if they were separate nodes in the chain.Example usage: