@@ -6,6 +6,7 @@ interface UseSwipeNavigationProps {
66 enabled : boolean ;
77 onNavigateLeft : ( ) => void ;
88 onNavigateRight : ( ) => void ;
9+ onSwipingChange ?: ( swiping : boolean ) => void ;
910 wrapperRef : RefObject < HTMLDivElement | null > ;
1011 currentRef : RefObject < HTMLDivElement | null > ;
1112 prevRef : RefObject < HTMLDivElement | null > ;
@@ -59,13 +60,20 @@ export const useSwipeNavigation = ({
5960 enabled,
6061 onNavigateLeft,
6162 onNavigateRight,
63+ onSwipingChange,
6264 wrapperRef,
6365 currentRef,
6466 prevRef,
6567 nextRef,
6668 hasPrev,
6769 hasNext,
6870} : UseSwipeNavigationProps ) => {
71+ const _setOverlaysVisible = ( visible : boolean ) => {
72+ const display = visible ? "" : "none" ;
73+ if ( prevRef . current ) prevRef . current . style . display = display ;
74+ if ( nextRef . current ) nextRef . current . style . display = display ;
75+ } ;
76+
6977 const touchStartRef = useRef < { x : number ; y : number ; time : number } | null > ( null ) ;
7078 const directionLockedRef = useRef < "horizontal" | "vertical" | null > ( null ) ;
7179 const navigatingRef = useRef ( false ) ;
@@ -96,6 +104,7 @@ export const useSwipeNavigation = ({
96104 _setWillChange ( currentRef . current , false ) ;
97105 _setWillChange ( prevRef . current , false ) ;
98106 _setWillChange ( nextRef . current , false ) ;
107+ _setOverlaysVisible ( false ) ;
99108 } ;
100109
101110 if ( transition && wasSwiping ) {
@@ -160,6 +169,7 @@ export const useSwipeNavigation = ({
160169 }
161170 directionLockedRef . current = "horizontal" ;
162171 swipingRef . current = true ;
172+ _setOverlaysVisible ( true ) ;
163173 _setWillChange ( currentRef . current , true ) ;
164174 _setWillChange ( prevRef . current , true ) ;
165175 _setWillChange ( nextRef . current , true ) ;
0 commit comments