Anyone have any idea why my AlertDialog only shows a single line of text even though my text is much longer?
Colton Idle
01/12/2024, 4:03 PM
Copy code
val text = stateHolder.myFlow.collectAsState(initial = null).value.toString()
AlertDialog(
onDismissRequest = dismiss,
icon = { Icon(Icons.Filled.Settings, contentDescription = null) },
title = { Text(text = "Test") },
text = {
Log.e("ABC", text)
Text(
text = text
)
},
confirmButton = {},
dismissButton = {})
I end up with only one line going across my dialog. But logcat outputs
null
Some really long string that is the actual output of the flowable and I can see the whole thing in logcat but not the dialog
Colton Idle
01/12/2024, 4:05 PM
If I change the text arg to
Copy code
text = {
Log.e("ABC", text)
Text(
text = "blah".repeat(30)
)
},
then my dialog will show like 3 lines.
Pretty confused. my only hunch is that technically in my actual code, (as seen in logcat too) is that the initial value is null, and so the Dialog will not change it's height?
z
Zach Klippenstein (he/him) [MOD]
01/12/2024, 4:39 PM
Sounds plausible. As a workaround, you can just not show the alert until the value is non-null. But this sounds like a layout bug, please file
❤️ 1
👍 1
a
Atul Gupta
01/12/2024, 5:46 PM
I am not sure if this affect your findings or not.. but we should always log data using
SideEffect { Log.e("ABC", text) }
c
Colton Idle
01/12/2024, 6:07 PM
@Zach Klippenstein (he/him) [MOD] that suggestion helped! thanks