Emoji icon indicating copy to clipboard operation
Emoji copied to clipboard

Integration with Jetpack Compose ?

Open noe opened this issue 3 years ago • 5 comments

Is it possible to integrate Emoji with Jetpack Compose? If so, how? If not, is it planned?

noe avatar May 01 '22 19:05 noe

Currently not. Probably similar to emoji-material there should be a emoji-compose library module which has compose support

vanniktech avatar May 04 '22 08:05 vanniktech

It's possible now. I've used it in few application. You don't typically need any dependency for that. And Also I'll add up a bit of code how to convert the unicode to emotes using the function.

The code to convert unicode to emote. String(Character.toChars(/ur unicode/))

@Composable fun Smily() { Column( verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.fillMaxSize() ) { Text(text = String(Character.toChars(0x1F642)), fontSize = 100.sp) } }

Screenshot 2022-06-16 133639

PGautam27 avatar Jun 16 '22 08:06 PGautam27

I am trying to use the EmojiView in Jetpack like this,

val view = LocalView.current
AndroidView(factory = { context ->
                EmojiView(context).apply {
                    setUp(
                        onEmojiClickListener = { emoji ->
                            Log.d("emoji", emoji.unicode)
                        },
                        rootView = view,
                        editText = null,
                        onEmojiBackspaceClickListener = null
                    )
                }
            }, modifier = Modifier.weight(1f).fillMaxWidth())

Getting this error android.view.InflateException: Binary XML file line #2 in com.qwillio.vendi:layout/emoji_view_category: Binary XML file line #2 in com.qwillio.vendi:layout/emoji_view_category: Error inflating class android.widget.ImageButton Caused by: android.view.InflateException: Binary XML file line #2 in com.qwillio.vendi:layout/emoji_view_category: Error inflating class android.widget.ImageButton Caused by: java.lang.reflect.InvocationTargetException

how to properly use EmojiView in Jetpack compose? @vanniktech

frhnfrq avatar Jun 26 '22 05:06 frhnfrq

How do we use this in jetpack compose?

dessalines avatar Mar 22 '23 16:03 dessalines

any update here? I'm just trying to add the library to a KMP app and in the common compose module it's not available though in others it is

artemptushkin avatar May 21 '24 12:05 artemptushkin