Skip to content
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

Save screen location across recreation #1536

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test-app/presenter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ kotlin {
implementation projects.testApp.schema.compose
implementation projects.redwoodLazylayoutCompose
implementation projects.redwoodProtocolCompose
implementation libs.jetbrains.compose.runtime.saveable
implementation libs.paging.compose.common
implementation libs.kotlinx.coroutines.core
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.Stable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import app.cash.redwood.Modifier
import app.cash.redwood.compose.BackHandler
import app.cash.redwood.layout.api.Constraint.Companion.Fill
Expand All @@ -44,7 +44,7 @@ class TestContext(

@Composable
fun TestApp(context: TestContext) {
val screenKeyState = remember { mutableStateOf<String?>(null) }
val screenKeyState = rememberSaveable { mutableStateOf<String?>(null) }
val screenKey = screenKeyState.value
if (screenKey == null) {
ScreenList(screenKeyState)
Expand Down