@@ -161,6 +161,8 @@ import androidx.compose.ui.semantics.Role
161161import androidx.compose.ui.semantics.role
162162import androidx.compose.ui.platform.testTag
163163import androidx.compose.ui.platform.LocalUriHandler
164+ import androidx.compose.ui.window.Popup
165+ import androidx.compose.ui.window.PopupProperties
164166import androidx.compose.ui.graphics.Color
165167import androidx.compose.ui.layout.ContentScale
166168import androidx.compose.ui.graphics.ImageBitmap
@@ -416,6 +418,8 @@ private fun RenderResolved(node: ViewNode) {
416418
417419 " Stepper" -> RenderStepper (node)
418420
421+ " Popover" -> RenderPopover (node)
422+
419423 " ContextMenu" -> RenderContextMenu (node)
420424
421425 " Menu" -> RenderMenu (node)
@@ -896,6 +900,40 @@ private fun formatDateMillis(millis: Long): String {
896900 return format.format(java.util.Date (millis))
897901}
898902
903+ // Anchors a floating bubble to its content while presented. children are
904+ // [anchor..., body...]; anchorCount splits them. Dismissing off the bubble
905+ // writes the bound flag back through onDismiss.
906+ @OptIn(ExperimentalMaterial3Api ::class )
907+ @Composable
908+ private fun RenderPopover (node : ViewNode ) {
909+ val anchorCount = node.long(" anchorCount" )?.toInt() ? : 0
910+ val presented = node.string(" isPresented" ) == " true"
911+ val onDismiss = node.long(" onDismiss" )
912+ Box {
913+ Column (modifier = node.composeModifiers()) {
914+ node.children.take(anchorCount).forEach { RenderChild (it) }
915+ }
916+ if (presented) {
917+ Popup (
918+ alignment = Alignment .TopStart ,
919+ offset = IntOffset (0 , 24 ),
920+ onDismissRequest = { onDismiss?.let { SwiftBridge .sink.invokeVoid(it) } },
921+ properties = PopupProperties (focusable = true ),
922+ ) {
923+ Surface (
924+ shadowElevation = 8 .dp,
925+ tonalElevation = 2 .dp,
926+ shape = RoundedCornerShape (12 .dp),
927+ ) {
928+ Column (modifier = Modifier .padding(16 .dp)) {
929+ node.children.drop(anchorCount).forEach { RenderChild (it) }
930+ }
931+ }
932+ }
933+ }
934+ }
935+ }
936+
899937// Long-press the content to reveal a dropdown of the menu items. children are
900938// [content..., menuItem...]; contentCount splits them.
901939@OptIn(ExperimentalFoundationApi ::class )
0 commit comments