paparazzi
paparazzi copied to clipboard
Lifecycle State for Compose should be RESUMED
Description
Composables that react to the lifecycle state, such as animation or consuming some flow, may not take effect in CREATED state. The default is CREATED so it will generally work, but for most screens RESUMED would be expected to be the state when users see the content.
See rememberStateWithLifecycle https://issuetracker.google.com/issues/230557927 which has optional param.
Steps to Reproduce
paparazzi.gif(start = 500L, end = 500L, fps = 1) {
var state by remember { mutableStateOf("Unset") }
LaunchedEffect(Unit) {
state = "Updated"
}
val lifecycle = LocalLifecycleOwner.current
Box(modifier = Modifier
.fillMaxSize()
.background(Color.DarkGray), contentAlignment = Alignment.Center) {
Column {
Text(text = "Lifecycle: ${lifecycle.lifecycle.currentState}")
Text(text = "State: ${state}")
}
}
}
Expected behavior
Lifecycle aware composables, are rendered in RESUMED state.
Additional information:
- Paparazzi Version: 1.0 (with draft PR)
Screenshots If applicable, add screenshots to help explain your problem.
Specifically relates to this PR. https://github.com/cashapp/paparazzi/pull/509
Fixed with https://github.com/cashapp/paparazzi/pull/740