EmojiButtonWrapper: improve touch behavior
This commit is contained in:
parent
eaf42370b9
commit
9596ed072b
|
@ -44,13 +44,19 @@ const EmojiButtonWrapper: React.FC<IEmojiButtonWrapper> = ({ statusId, children
|
||||||
if (!status) return null;
|
if (!status) return null;
|
||||||
|
|
||||||
const handleMouseEnter = () => {
|
const handleMouseEnter = () => {
|
||||||
|
if (!isUserTouching()) {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMouseLeave = () => {
|
const handleMouseLeave = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleUnfocus = () => {
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
const handleReact = (emoji: string): void => {
|
const handleReact = (emoji: string): void => {
|
||||||
if (ownAccount) {
|
if (ownAccount) {
|
||||||
dispatch(simpleEmojiReact(status, emoji));
|
dispatch(simpleEmojiReact(status, emoji));
|
||||||
|
@ -77,6 +83,7 @@ const EmojiButtonWrapper: React.FC<IEmojiButtonWrapper> = ({ statusId, children
|
||||||
handleReact(meEmojiReact);
|
handleReact(meEmojiReact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,6 +113,7 @@ const EmojiButtonWrapper: React.FC<IEmojiButtonWrapper> = ({ statusId, children
|
||||||
<div onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
|
<div onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
|
||||||
{React.cloneElement(children, {
|
{React.cloneElement(children, {
|
||||||
onClick: handleClick,
|
onClick: handleClick,
|
||||||
|
onBlur: handleUnfocus,
|
||||||
ref,
|
ref,
|
||||||
})}
|
})}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue