paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Popup Content Missing in Paparazzi Rendered Snapshots for Composable Functions

Open hd-bitingbit opened this issue 1 year ago • 4 comments

Description When attempting to record a snapshot using Paparazzi for a composable function with a Popup, the content of the Popup disappears in the recorded snapshot.

Steps to Reproduce

  1. Create a composable function that includes a Popup to display information. Sample Code:
@Composable
fun TestPopup() {
    MaterialTheme {
        Column(modifier = Modifier.fillMaxSize()) {
            Text(text = "Sample text")
            Popup(alignment = Alignment.BottomCenter) {
                Text(
                    text = "Hello Snapshot!",
                    modifier = Modifier
                        .fillMaxWidth()
                        .heightIn(min = 60.dp),
                    textAlign = TextAlign.Center,
                    color = Color.Black
                )
            }
        }
    }
}
  1. Attempt to record a snapshot using Paparazzi.

Expected behavior The recorded snapshot should accurately capture the content of the Popup along with the rest of the composable function.

Actual behavior In the recorded snapshot, the Popup is drawn, but the content within it is missing.

Additional information:

  • Paparazzi Version: 1.3.1
  • OS: Mac - Sonoma 14.2.1
  • Compile SDK: 34
  • Gradle Version:
  • Android Gradle Plugin Version:

Screenshots Preview Screenshot: Screenshot 2024-05-07 at 11 17 07 Recorded Snapshot: Screenshot 2024-05-07 at 10 38 52

hd-bitingbit avatar May 07 '24 09:05 hd-bitingbit

I have this issue too, But in my case it cannot render Dialog Composable.

juckrit avatar Jun 02 '24 16:06 juckrit

Hi @geoff-powell, have you made any progress on it? Thanks

kevinzheng-ap avatar Jun 19 '24 12:06 kevinzheng-ap

Yep, I have a branch with some code that solves this issue. Basically debugged AS Layout Lib and noticed that LL fires multiple render calls to get render the UI. The tracks if the recomposer has pending compositions, and will call a subsequent render per each frame that is rendered.

Still debugging if that is the best solution.

geoff-powell avatar Jun 20 '24 18:06 geoff-powell

@geoff-powell Any updates? I'm also having this issue.

upsidechasn avatar Jul 03 '24 23:07 upsidechasn

Yes, I have a PR here that solves this issue. Just needs some 👀 on it.

geoff-powell avatar Aug 20 '24 14:08 geoff-powell

Also running into this. When can we expect Paparazzi 1.3.5?

skylerreimer avatar Sep 24 '24 21:09 skylerreimer

Still seeing this in 1.3.5-20241008.184236-123

mshearer123 avatar Oct 09 '24 08:10 mshearer123

^ this seems to be because we wrap all content in a surface, which seems to make dialogs disappear for this version

mshearer123 avatar Oct 11 '24 11:10 mshearer123

@mshearer123 hmm, do you mind providing a small sample project to reproduce the issue you are experiencing. Once that's done, we can take a look and maybe open a new issue or reopen this issue

geoff-powell avatar Oct 11 '24 12:10 geoff-powell