Skip to content

Commit

Permalink
Fix custom categories not showing up when using the categories prop
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmed2000 committed Nov 14, 2024
1 parent 16978d0 commit d806942
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/emoji-mart/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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
})
Expand Down

0 comments on commit d806942

Please sign in to comment.