This repository was archived by the owner on Nov 27, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -335,9 +335,9 @@ Style to apply to the view wrapping each screen. You can pass this to override s
335335
336336Style to apply to the tab view container.
337337
338- ### ` disableChangeTabAnimation `
338+ ### ` animationEnabled `
339339
340- Boolean indicating whether to disable the change tab animation .
340+ Enables animation when changing tab. By default it's true .
341341
342342### ` TabBar `
343343
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export default function PagerViewAdapter<T extends Route>({
4141 onSwipeEnd,
4242 children,
4343 style,
44- disableChangeTabAnimation ,
44+ animationEnabled ,
4545 ...rest
4646} : Props < T > ) {
4747 const { index } = navigationState ;
@@ -64,11 +64,11 @@ export default function PagerViewAdapter<T extends Route>({
6464 ( route : { key : string } ) => route . key === key
6565 ) ;
6666
67- if ( disableChangeTabAnimation ) {
67+ if ( animationEnabled ) {
68+ pagerRef . current ?. setPage ( index ) ;
69+ } else {
6870 pagerRef . current ?. setPageWithoutAnimation ( index ) ;
6971 position . setValue ( index ) ;
70- } else {
71- pagerRef . current ?. setPage ( index ) ;
7272 }
7373 // eslint-disable-next-line react-hooks/exhaustive-deps
7474 } , [ ] ) ;
@@ -79,11 +79,11 @@ export default function PagerViewAdapter<T extends Route>({
7979 }
8080
8181 if ( indexRef . current !== index ) {
82- if ( disableChangeTabAnimation ) {
82+ if ( animationEnabled ) {
83+ pagerRef . current ?. setPage ( index ) ;
84+ } else {
8385 pagerRef . current ?. setPageWithoutAnimation ( index ) ;
8486 position . setValue ( index ) ;
85- } else {
86- pagerRef . current ?. setPage ( index ) ;
8787 }
8888 }
8989 // eslint-disable-next-line react-hooks/exhaustive-deps
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export default function TabView<T extends Route>({
4949 style,
5050 swipeEnabled = true ,
5151 tabBarPosition = 'top' ,
52- disableChangeTabAnimation ,
52+ animationEnabled = true ,
5353} : Props < T > ) {
5454 const [ layout , setLayout ] = React . useState ( {
5555 width : 0 ,
@@ -85,7 +85,7 @@ export default function TabView<T extends Route>({
8585 onSwipeStart = { onSwipeStart }
8686 onSwipeEnd = { onSwipeEnd }
8787 onIndexChange = { jumpToIndex }
88- disableChangeTabAnimation = { disableChangeTabAnimation }
88+ animationEnabled = { animationEnabled }
8989 >
9090 { ( { position, render, addEnterListener, jumpTo } ) => {
9191 // All of the props here must not change between re-renders
Original file line number Diff line number Diff line change @@ -55,5 +55,5 @@ export type PagerProps = Omit<
5555 swipeEnabled ?: boolean ;
5656 onSwipeStart ?: ( ) => void ;
5757 onSwipeEnd ?: ( ) => void ;
58- disableChangeTabAnimation ?: boolean ;
58+ animationEnabled ?: boolean ;
5959} ;
You can’t perform that action at this time.
0 commit comments