@@ -72,6 +72,7 @@ export const SwipeableContainer = (props: SwipeableContainerProps): ReactElement
7272 const [ activeIndex , setActiveIndex ] = useState ( 0 ) ;
7373 const flashList = useRef < FlashListRef < any > > ( null ) ;
7474 const isInitializing = useRef ( true ) ;
75+ const isInternalUpdate = useRef ( false ) ;
7576
7677 const rtlSafeIndex = useCallback (
7778 ( i : number ) : number => ( isAndroidRTL ? props . slides . length - 1 - i : i ) ,
@@ -91,6 +92,12 @@ export const SwipeableContainer = (props: SwipeableContainerProps): ReactElement
9192 ) ;
9293
9394 useEffect ( ( ) => {
95+ // Skip if this change was triggered by our own navigation
96+ if ( isInternalUpdate . current ) {
97+ isInternalUpdate . current = false ;
98+ return ;
99+ }
100+
94101 const slide = refreshActiveSlideAttribute ( props . slides , props . activeSlide ) ;
95102 if ( width && props . activeSlide ?. status === ValueStatus . Available && slide !== activeIndex ) {
96103 goToSlide ( slide ) ;
@@ -190,6 +197,8 @@ export const SwipeableContainer = (props: SwipeableContainerProps): ReactElement
190197 const onSlideChange = useCallback (
191198 ( newIndex : number , lastIndex : number ) : void => {
192199 if ( props . activeSlide && ! props . activeSlide . readOnly ) {
200+ // Mark this as an internal update before setting the value
201+ isInternalUpdate . current = true ;
193202 props . activeSlide . setValue ( new Big ( newIndex + 1 ) ) ;
194203 }
195204 if ( props . onSlideChange ) {
0 commit comments