hey using the `AndroidFragment` composable, it cha...
# navigation-architecture-component
a
hey using the
AndroidFragment
composable, it changes how fragments exist in the fragment manager of the host fragment. in this case, im hosting a
NavHost
within a fragment, where in the traditional version, same except using regular fragment transactions. When an
AndroidFragment
goes onto the backstack in navigation compose,
onDispose
is called, removing the fragment from the fragment manager. This changes how fragments typically exist in the pure fragment world, where they exist on the backstack with same instance. for legacy reasons, we have a bunch of screens expecting the same instance is used when fragment is reentered (setting fields improperly). In short, my guess is that this is expected behavior and that we should roll out our own variant of
AndroidFragment
emulating this behavior?
essentially the workaround is to
detach
the fragments, and reattach if they exist upon reentry:
Untitled
this feels wrong, because of the fragments hanging around, and i plan to implement a backhandler to remove the fragment reference when going backwards