mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 23:12:13 +00:00
clear timeout before starting a new one
This commit is contained in:
parent
4843a8f1a9
commit
d9645c5c72
2 changed files with 3 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ const Button = React.forwardRef(({ className, href, disabled, children, onLongPr
|
|||
const longPressTimeout = React.useRef(null);
|
||||
const onTouchStart = React.useCallback((event) => {
|
||||
longPressTimeout.current = setTimeout(function () {
|
||||
clearTimeout(longPressTimeout.current);
|
||||
if (typeof onLongPress === 'function') {
|
||||
onLongPress(event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
|
|||
toggleMenu();
|
||||
}
|
||||
}, [toggleMenu]);
|
||||
const popupMenuOnLongPress = React.useCallback((event) => {
|
||||
const popupMenuOTouchStart = React.useCallback((event) => {
|
||||
event.nativeEvent.togglePopupPrevented = true;
|
||||
}, []);
|
||||
const popupMenuOnContextMenu = React.useCallback((event) => {
|
||||
|
|
@ -142,7 +142,7 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
|
|||
}, []);
|
||||
const renderMenu = React.useMemo(() => function renderMenu() {
|
||||
return (
|
||||
<div className={styles['context-menu-content']} onTouchStart={popupMenuOnLongPress} onContextMenu={popupMenuOnContextMenu} onClick={popupMenuOnClick}>
|
||||
<div className={styles['context-menu-content']} onTouchStart={popupMenuOTouchStart} onContextMenu={popupMenuOnContextMenu} onClick={popupMenuOnClick}>
|
||||
<Button className={styles['context-menu-option-container']} title={'Watch'}>
|
||||
<div className={styles['context-menu-option-label']}>{t('CTX_WATCH')}</div>
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue