emoji-picker-react 4.7.7-rc.0 → 4.7.7
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/components/body/Suggested.d.ts +1 -1
- package/dist/emoji-picker-react.cjs.development.js +11 -6
- 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 +11 -6
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/useIsEverMounted.d.ts +1 -0
- package/package.json +1 -1
- package/src/Stylesheet/stylesheet.tsx +2 -2
- package/src/components/body/EmojiList.tsx +1 -1
- package/src/components/body/Suggested.tsx +6 -0
- package/src/hooks/useIsEverMounted.ts +14 -0
- package/dist/hooks/useIsMounted.d.ts +0 -1
- package/src/hooks/useIsMounted.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsEverMounted(): boolean;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { createSheet } from 'flairup';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { ClassNames } from '../DomUtils/classNames';
|
|
5
|
-
import {
|
|
5
|
+
import { useIsEverMounted } from '../hooks/useIsEverMounted';
|
|
6
6
|
|
|
7
7
|
export const stylesheet = createSheet('epr');
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ export const commonStyles = stylesheet.create({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
export function PickerStyleTag() {
|
|
25
|
-
const isMounted =
|
|
25
|
+
const isMounted = useIsEverMounted();
|
|
26
26
|
|
|
27
27
|
if (stylesheet.isApplied() && isMounted) {
|
|
28
28
|
return null;
|
|
@@ -32,7 +32,7 @@ export function EmojiList() {
|
|
|
32
32
|
const renderdCategoriesCountRef = React.useRef(0);
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<ul className={cx(styles.emojiList)}
|
|
35
|
+
<ul className={cx(styles.emojiList)}>
|
|
36
36
|
{categories.map(categoryConfig => {
|
|
37
37
|
const category = categoryFromCategoryConfig(categoryConfig);
|
|
38
38
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from '../../config/useConfig';
|
|
9
9
|
import { emojiByUnified } from '../../dataUtils/emojiSelectors';
|
|
10
10
|
import { getSuggested } from '../../dataUtils/suggested';
|
|
11
|
+
import { useIsEverMounted } from '../../hooks/useIsEverMounted';
|
|
11
12
|
import { useUpdateSuggested } from '../context/PickerContext';
|
|
12
13
|
import { ClickableEmoji } from '../emoji/Emoji';
|
|
13
14
|
|
|
@@ -19,6 +20,7 @@ type Props = Readonly<{
|
|
|
19
20
|
|
|
20
21
|
export function Suggested({ categoryConfig }: Props) {
|
|
21
22
|
const [suggestedUpdated] = useUpdateSuggested();
|
|
23
|
+
const isMounted = useIsEverMounted();
|
|
22
24
|
const suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
|
|
23
25
|
const getEmojiUrl = useGetEmojiUrlConfig();
|
|
24
26
|
const suggested = React.useMemo(
|
|
@@ -28,6 +30,10 @@ export function Suggested({ categoryConfig }: Props) {
|
|
|
28
30
|
);
|
|
29
31
|
const emojiStyle = useEmojiStyleConfig();
|
|
30
32
|
|
|
33
|
+
if (!isMounted) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
return (
|
|
32
38
|
<EmojiCategory
|
|
33
39
|
categoryConfig={categoryConfig}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
let isEverMounted = false;
|
|
4
|
+
|
|
5
|
+
export function useIsEverMounted() {
|
|
6
|
+
const [isMounted, setIsMounted] = React.useState(isEverMounted);
|
|
7
|
+
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
setIsMounted(true);
|
|
10
|
+
isEverMounted = true;
|
|
11
|
+
}, []);
|
|
12
|
+
|
|
13
|
+
return isMounted || isEverMounted;
|
|
14
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useIsMounted(): boolean;
|