mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Fix dup keys
This commit is contained in:
parent
9d06c88289
commit
46f5d7917c
1 changed files with 7 additions and 2 deletions
|
@ -17,12 +17,17 @@ function EmojiText({ text, emojis }) {
|
||||||
// 'g',
|
// 'g',
|
||||||
// );
|
// );
|
||||||
const regex = shortcodesRegexp(emojis.map((e) => e.shortcode));
|
const regex = shortcodesRegexp(emojis.map((e) => e.shortcode));
|
||||||
const elements = text.split(regex).map((word) => {
|
const elements = text.split(regex).map((word, i) => {
|
||||||
const emoji = emojis.find((e) => e.shortcode === word);
|
const emoji = emojis.find((e) => e.shortcode === word);
|
||||||
if (emoji) {
|
if (emoji) {
|
||||||
const { url, staticUrl } = emoji;
|
const { url, staticUrl } = emoji;
|
||||||
return (
|
return (
|
||||||
<CustomEmoji staticUrl={staticUrl} alt={word} url={url} key={word} />
|
<CustomEmoji
|
||||||
|
staticUrl={staticUrl}
|
||||||
|
alt={word}
|
||||||
|
url={url}
|
||||||
|
key={word + '-' + i} // Handle >= 2 same shortcodes
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return word;
|
return word;
|
||||||
|
|
Loading…
Reference in a new issue