EmojiBoard bug fixed
This commit is contained in:
parent
0404f30c87
commit
ebac0db0df
1 changed files with 5 additions and 5 deletions
|
@ -7,12 +7,12 @@ import ContextMenu from '../../atoms/context-menu/ContextMenu';
|
||||||
import EmojiBoard from './EmojiBoard';
|
import EmojiBoard from './EmojiBoard';
|
||||||
|
|
||||||
let requestCallback = null;
|
let requestCallback = null;
|
||||||
|
let isEmojiBoardVisible = false;
|
||||||
function EmojiBoardOpener() {
|
function EmojiBoardOpener() {
|
||||||
const openerRef = useRef(null);
|
const openerRef = useRef(null);
|
||||||
|
|
||||||
function openEmojiBoard(cords, requestEmojiCallback) {
|
function openEmojiBoard(cords, requestEmojiCallback) {
|
||||||
console.log(requestCallback);
|
if (requestCallback !== null || isEmojiBoardVisible) {
|
||||||
if (requestCallback !== null) {
|
|
||||||
requestCallback = null;
|
requestCallback = null;
|
||||||
if (cords.detail === 0) openerRef.current.click();
|
if (cords.detail === 0) openerRef.current.click();
|
||||||
return;
|
return;
|
||||||
|
@ -30,10 +30,10 @@ function EmojiBoardOpener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterEmojiBoardToggle(isVisible) {
|
function afterEmojiBoardToggle(isVisible) {
|
||||||
console.log(isVisible);
|
isEmojiBoardVisible = isVisible;
|
||||||
if (!isVisible) {
|
if (!isVisible) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
requestCallback = null;
|
if (!isEmojiBoardVisible) requestCallback = null;
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ function EmojiBoardOpener() {
|
||||||
<EmojiBoard onSelect={addEmoji} />
|
<EmojiBoard onSelect={addEmoji} />
|
||||||
)}
|
)}
|
||||||
afterToggle={afterEmojiBoardToggle}
|
afterToggle={afterEmojiBoardToggle}
|
||||||
render={(toggleMenu, isVisible) => (
|
render={(toggleMenu) => (
|
||||||
<input
|
<input
|
||||||
ref={openerRef}
|
ref={openerRef}
|
||||||
onClick={toggleMenu}
|
onClick={toggleMenu}
|
||||||
|
|
Loading…
Reference in a new issue