diff --git a/emoji-compose/src/commonMain/kotlin/org/kodein/emoji/compose/text.kt b/emoji-compose/src/commonMain/kotlin/org/kodein/emoji/compose/text.kt index 722de57..4a81198 100644 --- a/emoji-compose/src/commonMain/kotlin/org/kodein/emoji/compose/text.kt +++ b/emoji-compose/src/commonMain/kotlin/org/kodein/emoji/compose/text.kt @@ -47,15 +47,10 @@ private fun WithNotoEmoji( append(text.substring(start, found.start)) val inlineContentID = "emoji:${found.emoji}" inlineContent[inlineContentID] = InlineTextContent(Placeholder(found.emoji.ratio().em, 1.em, PlaceholderVerticalAlign.Center)) { - var display: (@Composable () -> Unit)? by remember { mutableStateOf(null) } - LaunchedEffect(null) { - display = createDisplay(found.emoji) - } - if (display == null) { - placeholder(found.emoji) - } else { - display!!.invoke() + val display by produceState<(@Composable () -> Unit)?>(null, found.emoji) { + value = createDisplay(found.emoji) } + display?.invoke() ?: placeholder(found.emoji) } appendInlineContent(inlineContentID) start = found.end