Bug 1894120 - Fix bug causing duplicate CFRs to display r=android-reviewers,matt-tighe

Differential Revision: https://phabricator.services.mozilla.com/D208949
This commit is contained in:
Noah Bond 2024-05-01 17:24:54 +00:00
parent 32fab3f035
commit 169dae7fd2

View File

@ -59,19 +59,27 @@ fun CFRPopupLayout(
onCFRShown()
}
var popup: CFRPopup? = null
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
View(context)
View(context).also {
popup = CFRPopup(
anchor = it,
properties = properties,
onDismiss = onDismiss,
text = text,
action = action,
)
}
},
update = { view ->
CFRPopup(
anchor = view,
properties = properties,
onDismiss = onDismiss,
text = text,
action = action,
).show()
onRelease = {
popup?.dismiss()
popup = null
},
update = {
popup?.dismiss()
popup?.show()
},
)
}