mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03: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',
|
||||
// );
|
||||
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);
|
||||
if (emoji) {
|
||||
const { url, staticUrl } = emoji;
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue