emoji-picker-react 4.5.4 → 4.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emoji-picker-react.cjs.development.js +13 -7
- package/dist/emoji-picker-react.cjs.development.js.map +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
- package/dist/emoji-picker-react.esm.js +13 -7
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/EmojiList.tsx +13 -6
package/package.json
CHANGED
|
@@ -29,10 +29,11 @@ import './EmojiList.css';
|
|
|
29
29
|
|
|
30
30
|
export function EmojiList() {
|
|
31
31
|
const categories = useCategoriesConfig();
|
|
32
|
+
const renderdCategoriesCountRef = React.useRef(0);
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
35
|
<ul className={ClassNames.emojiList}>
|
|
35
|
-
{categories.map(
|
|
36
|
+
{categories.map(categoryConfig => {
|
|
36
37
|
const category = categoryFromCategoryConfig(categoryConfig);
|
|
37
38
|
|
|
38
39
|
if (category === Categories.SUGGESTED) {
|
|
@@ -42,9 +43,9 @@ export function EmojiList() {
|
|
|
42
43
|
return (
|
|
43
44
|
<RenderCategory
|
|
44
45
|
key={category}
|
|
45
|
-
index={index}
|
|
46
46
|
category={category}
|
|
47
47
|
categoryConfig={categoryConfig}
|
|
48
|
+
renderdCategoriesCountRef={renderdCategoriesCountRef}
|
|
48
49
|
/>
|
|
49
50
|
);
|
|
50
51
|
})}
|
|
@@ -53,13 +54,13 @@ export function EmojiList() {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
function RenderCategory({
|
|
56
|
-
index,
|
|
57
57
|
category,
|
|
58
|
-
categoryConfig
|
|
58
|
+
categoryConfig,
|
|
59
|
+
renderdCategoriesCountRef
|
|
59
60
|
}: {
|
|
60
|
-
index: number;
|
|
61
61
|
category: Categories;
|
|
62
62
|
categoryConfig: CategoryConfig;
|
|
63
|
+
renderdCategoriesCountRef: React.MutableRefObject<number>;
|
|
63
64
|
}) {
|
|
64
65
|
const isEmojiHidden = useIsEmojiHidden();
|
|
65
66
|
const lazyLoadEmojis = useLazyLoadEmojisConfig();
|
|
@@ -73,7 +74,13 @@ function RenderCategory({
|
|
|
73
74
|
// Small trick to defer the rendering of all emoji categories until the first category is visible
|
|
74
75
|
// This way the user gets to actually see something and not wait for the whole picker to render.
|
|
75
76
|
const emojisToPush =
|
|
76
|
-
!isPastInitialLoad &&
|
|
77
|
+
!isPastInitialLoad && renderdCategoriesCountRef.current > 0
|
|
78
|
+
? []
|
|
79
|
+
: emojisByCategory(category);
|
|
80
|
+
|
|
81
|
+
if (emojisToPush.length > 0) {
|
|
82
|
+
renderdCategoriesCountRef.current++;
|
|
83
|
+
}
|
|
77
84
|
|
|
78
85
|
let hiddenCounter = 0;
|
|
79
86
|
|