missive / emoji-mart

🏪 One component to pick them all
https://missiveapp.com/open/emoji-mart
MIT License
8.67k stars 835 forks source link

Cannot display Twemoji within the emoji picker #611

Closed ajfAfg closed 2 years ago

ajfAfg commented 2 years ago

The following is displayed.

image

This code, based on https://github.com/missive/emoji-mart/issues/575#issuecomment-1140387044, uses the picker as follows in Next.js.

export const EmojiPicker = (props: any): JSX.Element => {
  const pickerRef = useRef();
  const moduleRef = useRef();
  const handleDivRef = (divElem: HTMLDivElement) => {
    pickerRef.current = divElem as any;
    if (!moduleRef.current) {
      moduleRef.current = import("emoji-mart").then(
        (m) =>
          new m.Picker({
            ...props,
            ref: pickerRef,
            data: data,
            set: "twitter",
          })
      ) as any;
    }
  };
  return <div ref={handleDivRef} />;
};

Environment

EtienneLem commented 2 years ago

When using a set and providing the data locally, you should import the data related to that set. In your case, it would be something like:

import data from '@emoji-mart/data/sets/14/twitter.json'

Sorry for the lack of documentation, we’ll add more soon.

ajfAfg commented 2 years ago

Thank you!!!!!