-
-
Notifications
You must be signed in to change notification settings - Fork 306
Open
Description
Please complete the following information:
- Library Version v1.6.13
- Affected Device(s) Tested on Pixel 10 and Pixel 8 API 34 emulator
Describe the Bug:
Using the key parameter to trigger a balloon recomposition causes the balloon to close.
Expected Behavior:
The balloon should stay open and recompose according to the content.
Sample code:
@Composable
fun BasicBalloon() {
val balloonBuilder = getBalloonBuilder()
val showExtraText = remember { mutableStateOf(false) }
Balloon(
builder = balloonBuilder,
key = showExtraText.value,
balloonContent = {
Column(modifier = Modifier.fillMaxWidth()) {
Text("Testing")
Text("Testing row 2")
if (showExtraText.value) {
Text("Extra text shown")
}
Button(
onClick = { showExtraText.value = !showExtraText.value },
) {
Text("Toggle extra text")
}
}
},
content = { balloonWindow ->
Button(
onClick = { balloonWindow.showAlignBottom() },
) {
Text("Show Balloon")
}
},
)
}
// Just including this for completeness, I doubt this makes any difference
@Composable
private fun getBalloonBuilder(): Balloon.Builder {
val dialogBackground = MaterialTheme.colors.surface
val overlay = Color.Black.copy(alpha = 0.35f)
val balloonBuilder = rememberBalloonBuilder {
setBackgroundColor(dialogBackground)
setCornerRadius(12f)
setMarginHorizontal(16)
setPadding(16)
// Arrow
setArrowSize(20)
setArrowTopPadding(10)
setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
// Overlay
setIsVisibleOverlay(true)
setOverlayShape(BalloonOverlayRoundRect(16f, 16f))
setOverlayColor(overlay)
}
return balloonBuilder
}Metadata
Metadata
Assignees
Labels
No labels