New Chat: Fix unresponsive button on Android
This commit is contained in:
parent
4808711e09
commit
fe5136634f
@ -27,29 +27,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
&.menu-is-open {
|
||||
&::before {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -13rem;
|
||||
left: -11rem;
|
||||
right: -1rem;
|
||||
bottom: -1rem;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
|
||||
.is-touch-env & {
|
||||
.Menu > .backdrop {
|
||||
position: absolute;
|
||||
left: -100vw;
|
||||
right: -100vw;
|
||||
top: -100vh;
|
||||
bottom: -100vh;
|
||||
}
|
||||
}
|
||||
|
||||
> .Button {
|
||||
.icon-new-chat-filled,
|
||||
.icon-close {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import React, {
|
||||
FC, useCallback, useState, useEffect, memo,
|
||||
FC, useState, useEffect, memo,
|
||||
} from '../../lib/teact/teact';
|
||||
|
||||
import buildClassName from '../../util/buildClassName';
|
||||
@ -11,9 +11,6 @@ import MenuItem from '../ui/MenuItem';
|
||||
|
||||
import './NewChatButton.scss';
|
||||
|
||||
const MENU_CLOSE_DELAY_MS = 750;
|
||||
let closeTimeout: number | undefined;
|
||||
|
||||
type OwnProps = {
|
||||
isShown: boolean;
|
||||
onNewPrivateChat: () => void;
|
||||
@ -51,30 +48,8 @@ const NewChatButton: FC<OwnProps> = ({
|
||||
setIsMenuOpen(false);
|
||||
};
|
||||
|
||||
const handleMouseEnter = useCallback(() => {
|
||||
if (closeTimeout) {
|
||||
clearTimeout(closeTimeout);
|
||||
closeTimeout = undefined;
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleMouseLeave = useCallback(() => {
|
||||
if (closeTimeout) {
|
||||
clearTimeout(closeTimeout);
|
||||
closeTimeout = undefined;
|
||||
}
|
||||
|
||||
closeTimeout = window.setTimeout(() => {
|
||||
setIsMenuOpen(false);
|
||||
}, MENU_CLOSE_DELAY_MS);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={fabClassName}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
>
|
||||
<div className={fabClassName}>
|
||||
<Button
|
||||
round
|
||||
color="primary"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user