@@ -43,6 +43,7 @@ const SwipeableWrapper = forwardRef(
4343 transitionDuration,
4444 transitionTimingFunction,
4545 containerStyles,
46+ disableAutoScroll,
4647 } ,
4748 ref ,
4849 ) => {
@@ -58,7 +59,7 @@ const SwipeableWrapper = forwardRef(
5859 const currIndex = index . current ;
5960 rAF ( ( ) => {
6061 onSlideChange ( index . current ) ;
61- scrollToTop ( ) ;
62+ if ( ! disableAutoScroll ) scrollToTop ( ) ;
6263 const { current : el = null } = elementRef ;
6364 if ( el ) {
6465 const height = window . innerHeight - el . clientTop ;
@@ -68,7 +69,7 @@ const SwipeableWrapper = forwardRef(
6869 } ) ;
6970 previousIndex . current = index . current ;
7071 }
71- } , [ onSlideChange , rAF ] ) ;
72+ } , [ disableAutoScroll , onSlideChange , rAF ] ) ;
7273
7374 const swipeToIndex = useCallback (
7475 ( slideToIndex , avoidAnimation = false ) => {
@@ -223,7 +224,10 @@ const SwipeableWrapper = forwardRef(
223224
224225SwipeableWrapper . propTypes = {
225226 bottomBarRef : PropTypes . shape ( {
226- current : PropTypes . oneOf ( [ PropTypes . node , PropTypes . object ] ) ,
227+ current : PropTypes . oneOfType ( [
228+ PropTypes . node ,
229+ PropTypes . objectOf ( PropTypes . object ) ,
230+ ] ) ,
227231 } ) ,
228232 initialIndex : PropTypes . number ,
229233 onSlideChange : PropTypes . func ,
@@ -232,16 +236,18 @@ SwipeableWrapper.propTypes = {
232236 transitionDuration : PropTypes . number ,
233237 transitionTimingFunction : PropTypes . string ,
234238 containerStyles : PropTypes . shape ( { } ) ,
239+ disableAutoScroll : PropTypes . bool ,
235240} ;
236241
237242SwipeableWrapper . defaultProps = {
238- bottomBarRef : null ,
243+ bottomBarRef : { current : null } ,
239244 onSlideChange : ( ) => { } ,
240245 initialIndex : 0 ,
241246 filterNodes : [ ] ,
242247 transitionDuration : 300 ,
243248 transitionTimingFunction : "ease-out" ,
244249 containerStyles : { } ,
250+ disableAutoScroll : false ,
245251} ;
246252
247253export default memo ( SwipeableWrapper ) ;
0 commit comments