Closed pedrohenriquebraga closed 2 years ago
Can you share some more of the code that you're using? That's just a fragment of pure JavaScript and doesn't use the data in this library at all.
@iamcal
import _ from "lodash";
import emojiSource from "emoji-datasource";
const filteredEmojis = emojiSource.filter((e) => !e.obsoletes && !e.obsoleted_by);
const emojis = _.orderBy(filteredEmojis, "sort_order"))
// i'm passing the emoji unified code for this function
const codeToEmoji = (code: any) => {
// code = unified
return String.fromCodePoint(parseInt(code, 16));
}
it's my code, i'm using in React Native to create an Emoji Picker. This bug is occurring in android phone
(sorry my bad english)
the issue is that the unified
field does not just contain a single codepoint, for example "HASH KEY" has a value of "0023-FE0F-20E3"
. to make your code work correctly:
const codeToEmoji = (code: any) => {
// code = unified
var codes = code.split('-');
var buffer = '';
for (var i=0; i<codes.length; i++){
buffer += String.fromCodePoint(parseInt(codes[i], 16));
}
return buffer;
}
@iamcal This code works! But it generated another bug in some emojis (not all)
It was like the emojis had separated
It looks like the native rendering method you're using is unable to support certain codepoints, so they're appearing as their fallback (which is a sequence of images).
@iamcal is there any way to solve this?
I'm not sure what you're trying to do.
This project is a library of data to use in other applications. You should probably start with something higher level that's closer to whatever you're trying to accomplish. Maybe this is closer to what you're looking for: https://github.com/iamcal/js-emoji
I'm converting the unified code with
and i'm getting this result (emojis wrong and/or duplicated), how fix it?