From d80694272dc987d9b48367b959d59b7fb2701142 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 14 Nov 2024 12:33:57 +0500 Subject: [PATCH] Fix custom categories not showing up when using the categories prop --- packages/emoji-mart/src/config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/emoji-mart/src/config.ts b/packages/emoji-mart/src/config.ts index 725e3a38..5762affe 100644 --- a/packages/emoji-mart/src/config.ts +++ b/packages/emoji-mart/src/config.ts @@ -97,6 +97,7 @@ async function _init(props) { )) if (props.custom) { + Data.customCategories = [] for (let i in props.custom) { i = parseInt(i) const category = props.custom[i] @@ -112,6 +113,7 @@ async function _init(props) { } Data.categories.push(category) + Data.customCategories.push(category) for (const emoji of category.emojis) { Data.emojis[emoji.id] = emoji @@ -121,6 +123,11 @@ async function _init(props) { if (props.categories) { Data.categories = Data.originalCategories + .concat( + typeof Data.customCategories !== 'undefined' + ? Data.customCategories + : [], + ) .filter((c) => { return props.categories.indexOf(c.id) != -1 })