Extend swipe functionality.
This commit is contained in:
parent
1a05b353e6
commit
6ca16fae77
|
@ -96,10 +96,17 @@ const PresentNavigationOverlay = ({
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handlers = useSwipeable({
|
const handlers = useSwipeable({
|
||||||
|
onSwipedDown: () => {
|
||||||
|
if (disableSaveCloseInHistory === true) {
|
||||||
|
dispatchMedia({ type: 'closePresentMode' })
|
||||||
|
} else {
|
||||||
|
closePresentModeAction({ dispatchMedia })
|
||||||
|
}
|
||||||
|
},
|
||||||
onSwipedLeft: () => dispatchMedia({ type: 'nextImage' }),
|
onSwipedLeft: () => dispatchMedia({ type: 'nextImage' }),
|
||||||
onSwipedRight: () => dispatchMedia({ type: 'previousImage' }),
|
onSwipedRight: () => dispatchMedia({ type: 'previousImage' }),
|
||||||
preventScrollOnSwipe: false,
|
preventScrollOnSwipe: false,
|
||||||
trackMouse: false,
|
trackMouse: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -109,7 +116,7 @@ const PresentNavigationOverlay = ({
|
||||||
onMouseMove.current && onMouseMove.current()
|
onMouseMove.current && onMouseMove.current()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div {...handlers}>
|
<div {...handlers} data-testid="swipe-component">
|
||||||
{children}
|
{children}
|
||||||
<NavigationButton
|
<NavigationButton
|
||||||
aria-label="Previous image"
|
aria-label="Previous image"
|
||||||
|
|
Loading…
Reference in New Issue