paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Lifecycle State for Compose should be RESUMED

Open yschimke opened this issue 2 years ago • 1 comments

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.

yschimke avatar Jul 23 '22 14:07 yschimke

Specifically relates to this PR. https://github.com/cashapp/paparazzi/pull/509

yschimke avatar Jul 23 '22 14:07 yschimke

Fixed with https://github.com/cashapp/paparazzi/pull/740

gamepro65 avatar Mar 24 '23 13:03 gamepro65