Created
January 31, 2023 01:10
-
-
Save dgmltn/38a9fa3ece9cd4ce26a565b751c57011 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation("androidx.emoji2:emoji2:1.2.0") | |
// https://developer.android.com/jetpack/androidx/releases/emoji2#emoji2_emojipicker_version_10_2 | |
implementation("androidx.emoji2:emoji2-emojipicker:1.0.0-alpha01") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun EmojiGrid( | |
onEmojiPicked: (String) -> Unit, | |
modifier: Modifier = Modifier, | |
) { | |
val emojiPickedListener = androidx.core.util.Consumer<EmojiViewItem> { | |
onEmojiPicked(it.emoji) | |
} | |
Box( | |
modifier = modifier | |
.fillMaxSize() | |
) { | |
AndroidView( | |
modifier = modifier | |
.fillMaxSize(), | |
factory = { context -> | |
EmojiPickerView(context) | |
}, | |
update = { | |
it.setOnEmojiPickedListener(emojiPickedListener) | |
it.emojiGridRows = 5.5f | |
} | |
) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment