pass the event arguemnt and preventDefault

This commit is contained in:
dexter21767-dev 2023-07-03 11:22:10 +01:00
parent 11dc6a48bd
commit d43a2ade4b
2 changed files with 6 additions and 5 deletions

View file

@ -7,15 +7,15 @@ const styles = require('./styles');
const Button = React.forwardRef(({ className, href, disabled, children, onLongPress, ...props }, ref) => {
let pressTimer = null;
const onTouchStart = function () {
const onTouchStart = function (event) {
pressTimer = setTimeout(function () {
if (typeof onLongPress === 'function') {
//alert('longpress detected');
onLongPress();
onLongPress(event);
}
}, 650); // an artifact of previous menus staying on the screen will happen on Safari if the timeout was set to 600 and less, and 650 for PWA.
};
const onTouchEnd = function () {
const onTouchEnd = function (event) {
//event.preventDefault();
clearTimeout(pressTimer);
};
const onKeyDown = React.useCallback((event) => {

View file

@ -30,7 +30,8 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
toggleMenu();
}
}, [toggleMenu]);
const popupLabelOnLongPress = React.useCallback(() => {
const popupLabelOnLongPress = React.useCallback((event) => {
event.preventDefault();
toggleMenu();
}, [toggleMenu]);
const popupMenuOnContextMenu = React.useCallback((event) => {