-
-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Description
The same screen will be accidentally reorganized when it returns
The execution process is similar to the following:
TestScreen->TestScreen->TestScreen
This is the log record
start ->TestScreen Reorganization:0
enter -> TestScreen Reorganization:1
enter -> TestScreen Reorganization:2
back -> TestScreen Reorganization:1
back -> TestScreen Reorganization:0It can be seen that it is accidentally reorganized when returned, and no method can avoid it, including extracting functions, extracting State as remember, etc.
Thie my code
class TestScreen(
private val count : Int =0
) : Screen {
override val key: ScreenKey = "TestScreen#$count"
@Composable
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
CommonComposeUI<VideoPlayerViewModel> {
Column {
LogUtils.d("TestScreen Reorganization:$count")
Text(
text = "count: $count"
)
Button(
onClick = {
navigator.push(TestScreen(count + 1))
}
) {
Text("next")
}
}
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels