Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Jetpack Compose ? #690

Open
noe opened this issue May 1, 2022 · 5 comments
Open

Integration with Jetpack Compose ? #690

noe opened this issue May 1, 2022 · 5 comments

Comments

@noe
Copy link

noe commented May 1, 2022

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

@vanniktech
Copy link
Owner

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

@PGautam27
Copy link

PGautam27 commented Jun 16, 2022

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

@frhnfrq
Copy link

frhnfrq commented Jun 26, 2022

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

@dessalines
Copy link

How do we use this in jetpack compose?

@artemptushkin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants