From 7e3260290495ee65007a4d28943f694c3ca2bdb9 Mon Sep 17 00:00:00 2001 From: queue Date: Wed, 30 Oct 2024 23:58:42 +0900 Subject: [PATCH] fix: reuse if there is already defined custom element --- packages/emoji-mart-react/react.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/emoji-mart-react/react.tsx b/packages/emoji-mart-react/react.tsx index 978a87d5..da44f3e2 100644 --- a/packages/emoji-mart-react/react.tsx +++ b/packages/emoji-mart-react/react.tsx @@ -11,6 +11,11 @@ export default function EmojiPicker(props) { } useEffect(() => { + const PickerElement = window?.customElements.get('em-emoji-picker') + if (PickerElement) { + instance.current = new PickerElement({ ...props, ref }) + return + } instance.current = new Picker({ ...props, ref }) return () => {