File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
// From https://github.com/missive/emoji-mart/blob/main/packages/emoji-mart-react/react.tsx
2
2
import React , { useEffect , useRef } from "react" ;
3
- import { Picker } from "emoji-mart" ;
3
+
4
+ // Temporary fix for https://github.com/missive/emoji-mart/pull/929
5
+ let emojiMart : typeof import ( "emoji-mart" ) | undefined ;
4
6
5
7
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6
8
export default function EmojiPicker ( props : any ) {
@@ -12,7 +14,14 @@ export default function EmojiPicker(props: any) {
12
14
}
13
15
14
16
useEffect ( ( ) => {
15
- instance . current = new Picker ( { ...props , ref } ) ;
17
+ ( async ( ) => {
18
+ if ( ! emojiMart ) {
19
+ // load dynamically because emoji-mart doesn't specify type: module and breaks in nodejs
20
+ emojiMart = await import ( "emoji-mart" ) ;
21
+ }
22
+
23
+ instance . current = new emojiMart . Picker ( { ...props , ref } ) ;
24
+ } ) ( ) ;
16
25
17
26
return ( ) => {
18
27
instance . current = null ;
You can’t perform that action at this time.
0 commit comments