@react-navigation/material-top-tabs 6.2.3 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,6 +74,7 @@ function MaterialTopTabView(_ref) {
74
74
  },
75
75
  lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
76
76
  swipeEnabled: focusedOptions.swipeEnabled,
77
+ animationEnabled: focusedOptions.animationEnabled,
77
78
  onSwipeStart: () => navigation.emit({
78
79
  type: 'swipeStart'
79
80
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["MaterialTopTabView.tsx"],"names":["MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","CommonActions","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","emit","type","backgroundColor","background"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;AAQA;;;;;;;;;;AAQe,SAASA,kBAAT,OAOL;AAAA,MAPiC;AACzCC,IAAAA,MAAM,GAAIC,KAAD,iBAAmC,oBAAC,0BAAD,EAAuBA,KAAvB,CADH;AAEzCC,IAAAA,KAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,WAJyC;AAKzCC,IAAAA,mBALyC;AAMzC,OAAGC;AANsC,GAOjC;AACR,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;;AAEA,QAAMC,YAAY,GAAIP,KAAD,IAA+B;AAClD,WAAOD,MAAM,CAAC,EACZ,GAAGC,KADS;AAEZC,MAAAA,KAAK,EAAEA,KAFK;AAGZC,MAAAA,UAAU,EAAEA,UAHA;AAIZC,MAAAA,WAAW,EAAEA;AAJD,KAAD,CAAb;AAMD,GAPD;;AASA,QAAMK,cAAc,GAAGL,WAAW,CAACF,KAAK,CAACQ,MAAN,CAAaR,KAAK,CAACS,KAAnB,EAA0BC,GAA3B,CAAX,CAA2CC,OAAlE;AAEA,sBACE,oB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nB;AAAEC,MAAAA,eAAe,EAAErB,MAAM,CAACsB;AAA1B,KADmB,EAEnBxB,mBAFmB;AAtBvB,KADF;AA6BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
1
+ {"version":3,"sources":["MaterialTopTabView.tsx"],"names":["MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","CommonActions","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","animationEnabled","emit","type","backgroundColor","background"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;AAQA;;;;;;;;;;AAQe,SAASA,kBAAT,OAOL;AAAA,MAPiC;AACzCC,IAAAA,MAAM,GAAIC,KAAD,iBAAmC,oBAAC,0BAAD,EAAuBA,KAAvB,CADH;AAEzCC,IAAAA,KAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,WAJyC;AAKzCC,IAAAA,mBALyC;AAMzC,OAAGC;AANsC,GAOjC;AACR,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;;AAEA,QAAMC,YAAY,GAAIP,KAAD,IAA+B;AAClD,WAAOD,MAAM,CAAC,EACZ,GAAGC,KADS;AAEZC,MAAAA,KAAK,EAAEA,KAFK;AAGZC,MAAAA,UAAU,EAAEA,UAHA;AAIZC,MAAAA,WAAW,EAAEA;AAJD,KAAD,CAAb;AAMD,GAPD;;AASA,QAAMK,cAAc,GAAGL,WAAW,CAACF,KAAK,CAACQ,MAAN,CAAaR,KAAK,CAACS,KAAnB,EAA0BC,GAA3B,CAAX,CAA2CC,OAAlE;AAEA,sBACE,oBAAC,2BAAD,eACMP,IADN;AAEE,IAAA,aAAa,EAAGK,KAAD,IACbR,UAAU,CAACW,QAAX,CAAoB,EAClB,GAAGC,sBAAcC,QAAd,CAAuB;AACxBC,QAAAA,IAAI,EAAEf,KAAK,CAACQ,MAAN,CAAaC,KAAb,EAAoBM,IADF;AAExBC,QAAAA,KAAK,EAAE;AAFiB,OAAvB,CADe;AAKlBC,MAAAA,MAAM,EAAEjB,KAAK,CAACU;AALI,KAApB,CAHJ;AAWE,IAAA,WAAW,EAAE;AAAA,UAAC;AAAEQ,QAAAA;AAAF,OAAD;AAAA,aAAehB,WAAW,CAACgB,KAAK,CAACR,GAAP,CAAX,CAAuBS,MAAvB,EAAf;AAAA,KAXf;AAYE,IAAA,eAAe,EAAEnB,KAZnB;AAaE,IAAA,YAAY,EAAEM,YAbhB;AAcE,IAAA,qBAAqB,EAAE;AAAA;;AAAA,UAAC;AAAEY,QAAAA;AAAF,OAAD;AAAA,gEACrB,0BAAAhB,WAAW,CAACgB,KAAK,CAACR,GAAP,CAAX,CAAuBC,OAAvB,EAA+BS,eADV,2DACrB,mDADqB,yEACiC,IADjC;AAAA,KAdzB;AAiBE,IAAA,IAAI,EAAE;AAAA,UAAC;AAAEF,QAAAA;AAAF,OAAD;AAAA,aAAehB,WAAW,CAACgB,KAAK,CAACR,GAAP,CAAX,CAAuBC,OAAvB,CAA+BU,IAA/B,KAAwC,IAAvD;AAAA,KAjBR;AAkBE,IAAA,mBAAmB,EAAEd,cAAc,CAACe,mBAlBtC;AAmBE,IAAA,YAAY,EAAEf,cAAc,CAACgB,YAnB/B;AAoBE,IAAA,gBAAgB,EAAEhB,cAAc,CAACiB,gBApBnC;AAqBE,IAAA,YAAY,EAAE,MAAMvB,UAAU,CAACwB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CArBtB;AAsBE,IAAA,UAAU,EAAE,MAAMzB,UAAU,CAACwB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CAtBpB;AAuBE,IAAA,mBAAmB,EAAE,CACnB;AAAEC,MAAAA,eAAe,EAAEtB,MAAM,CAACuB;AAA1B,KADmB,EAEnBzB,mBAFmB;AAvBvB,KADF;AA8BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n animationEnabled={focusedOptions.animationEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
@@ -57,6 +57,7 @@ export default function MaterialTopTabView(_ref) {
57
57
  },
58
58
  lazyPreloadDistance: focusedOptions.lazyPreloadDistance,
59
59
  swipeEnabled: focusedOptions.swipeEnabled,
60
+ animationEnabled: focusedOptions.animationEnabled,
60
61
  onSwipeStart: () => navigation.emit({
61
62
  type: 'swipeStart'
62
63
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["MaterialTopTabView.tsx"],"names":["CommonActions","useTheme","React","TabView","MaterialTopTabBar","MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPreloadDistance","swipeEnabled","emit","type","backgroundColor","background"],"mappings":";;AAAA,SACEA,aADF,EAKEC,QALF,QAMO,0BANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAA6BC,OAA7B,QAA4C,uBAA5C;AAQA,OAAOC,iBAAP,MAA8B,qBAA9B;AAQA,eAAe,SAASC,kBAAT,OAOL;AAAA,MAPiC;AACzCC,IAAAA,MAAM,GAAIC,KAAD,iBAAmC,oBAAC,iBAAD,EAAuBA,KAAvB,CADH;AAEzCC,IAAAA,KAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,WAJyC;AAKzCC,IAAAA,mBALyC;AAMzC,OAAGC;AANsC,GAOjC;AACR,QAAM;AAAEC,IAAAA;AAAF,MAAaZ,QAAQ,EAA3B;;AAEA,QAAMa,YAAY,GAAIP,KAAD,IAA+B;AAClD,WAAOD,MAAM,CAAC,EACZ,GAAGC,KADS;AAEZC,MAAAA,KAAK,EAAEA,KAFK;AAGZC,MAAAA,UAAU,EAAEA,UAHA;AAIZC,MAAAA,WAAW,EAAEA;AAJD,KAAD,CAAb;AAMD,GAPD;;AASA,QAAMK,cAAc,GAAGL,WAAW,CAACF,KAAK,CAACQ,MAAN,CAAaR,KAAK,CAACS,KAAnB,EAA0BC,GAA3B,CAAX,CAA2CC,OAAlE;AAEA,sBACE,oBAAC,OAAD,eACMP,IADN;AAEE,IAAA,aAAa,EAAGK,KAAD,IACbR,UAAU,CAACW,QAAX,CAAoB,EAClB,GAAGpB,aAAa,CAACqB,QAAd,CAAuB;AACxBC,QAAAA,IAAI,EAAEd,KAAK,CAACQ,MAAN,CAAaC,KAAb,EAAoBK,IADF;AAExBC,QAAAA,KAAK,EAAE;AAFiB,OAAvB,CADe;AAKlBC,MAAAA,MAAM,EAAEhB,KAAK,CAACU;AALI,KAApB,CAHJ;AAWE,IAAA,WAAW,EAAE;AAAA,UAAC;AAAEO,QAAAA;AAAF,OAAD;AAAA,aAAef,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBQ,MAAvB,EAAf;AAAA,KAXf;AAYE,IAAA,eAAe,EAAElB,KAZnB;AAaE,IAAA,YAAY,EAAEM,YAbhB;AAcE,IAAA,qBAAqB,EAAE;AAAA;;AAAA,UAAC;AAAEW,QAAAA;AAAF,OAAD;AAAA,gEACrB,0BAAAf,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,EAA+BQ,eADV,2DACrB,mDADqB,yEACiC,IADjC;AAAA,KAdzB;AAiBE,IAAA,IAAI,EAAE;AAAA,UAAC;AAAEF,QAAAA;AAAF,OAAD;AAAA,aAAef,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,CAA+BS,IAA/B,KAAwC,IAAvD;AAAA,KAjBR;AAkBE,IAAA,mBAAmB,EAAEb,cAAc,CAACc,mBAlBtC;AAmBE,IAAA,YAAY,EAAEd,cAAc,CAACe,YAnB/B;AAoBE,IAAA,YAAY,EAAE,MAAMrB,UAAU,CAACsB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CApBtB;AAqBE,IAAA,UAAU,EAAE,MAAMvB,UAAU,CAACsB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CArBpB;AAsBE,IAAA,mBAAmB,EAAE,CACnB;AAAEC,MAAAA,eAAe,EAAEpB,MAAM,CAACqB;AAA1B,KADmB,EAEnBvB,mBAFmB;AAtBvB,KADF;AA6BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
1
+ {"version":3,"sources":["MaterialTopTabView.tsx"],"names":["CommonActions","useTheme","React","TabView","MaterialTopTabBar","MaterialTopTabView","tabBar","props","state","navigation","descriptors","sceneContainerStyle","rest","colors","renderTabBar","focusedOptions","routes","index","key","options","dispatch","navigate","name","merge","target","route","render","lazyPlaceholder","lazy","lazyPre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AACe,KAAK,CAACP,GAAP,CAAX,CAAuBQ,MAAvB,EAAf;AAAA,KAXf;AAYE,IAAA,eAAe,EAAElB,KAZnB;AAaE,IAAA,YAAY,EAAEM,YAbhB;AAcE,IAAA,qBAAqB,EAAE;AAAA;;AAAA,UAAC;AAAEW,QAAAA;AAAF,OAAD;AAAA,gEACrB,0BAAAf,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,EAA+BQ,eADV,2DACrB,mDADqB,yEACiC,IADjC;AAAA,KAdzB;AAiBE,IAAA,IAAI,EAAE;AAAA,UAAC;AAAEF,QAAAA;AAAF,OAAD;AAAA,aAAef,WAAW,CAACe,KAAK,CAACP,GAAP,CAAX,CAAuBC,OAAvB,CAA+BS,IAA/B,KAAwC,IAAvD;AAAA,KAjBR;AAkBE,IAAA,mBAAmB,EAAEb,cAAc,CAACc,mBAlBtC;AAmBE,IAAA,YAAY,EAAEd,cAAc,CAACe,YAnB/B;AAoBE,IAAA,gBAAgB,EAAEf,cAAc,CAACgB,gBApBnC;AAqBE,IAAA,YAAY,EAAE,MAAMtB,UAAU,CAACuB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CArBtB;AAsBE,IAAA,UAAU,EAAE,MAAMxB,UAAU,CAACuB,IAAX,CAAgB;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAhB,CAtBpB;AAuBE,IAAA,mBAAmB,EAAE,CACnB;AAAEC,MAAAA,eAAe,EAAErB,MAAM,CAACsB;AAA1B,KADmB,EAEnBxB,mBAFmB;AAvBvB,KADF;AA8BD","sourcesContent":["import {\n CommonActions,\n ParamListBase,\n Route,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { SceneRendererProps, TabView } from 'react-native-tab-view';\n\nimport type {\n MaterialTopTabBarProps,\n MaterialTopTabDescriptorMap,\n MaterialTopTabNavigationConfig,\n MaterialTopTabNavigationHelpers,\n} from '../types';\nimport MaterialTopTabBar from './MaterialTopTabBar';\n\ntype Props = MaterialTopTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: MaterialTopTabNavigationHelpers;\n descriptors: MaterialTopTabDescriptorMap;\n};\n\nexport default function MaterialTopTabView({\n tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,\n state,\n navigation,\n descriptors,\n sceneContainerStyle,\n ...rest\n}: Props) {\n const { colors } = useTheme();\n\n const renderTabBar = (props: SceneRendererProps) => {\n return tabBar({\n ...props,\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n });\n };\n\n const focusedOptions = descriptors[state.routes[state.index].key].options;\n\n return (\n <TabView<Route<string>>\n {...rest}\n onIndexChange={(index) =>\n navigation.dispatch({\n ...CommonActions.navigate({\n name: state.routes[index].name,\n merge: true,\n }),\n target: state.key,\n })\n }\n renderScene={({ route }) => descriptors[route.key].render()}\n navigationState={state}\n renderTabBar={renderTabBar}\n renderLazyPlaceholder={({ route }) =>\n descriptors[route.key].options.lazyPlaceholder?.() ?? null\n }\n lazy={({ route }) => descriptors[route.key].options.lazy === true}\n lazyPreloadDistance={focusedOptions.lazyPreloadDistance}\n swipeEnabled={focusedOptions.swipeEnabled}\n animationEnabled={focusedOptions.animationEnabled}\n onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}\n onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}\n sceneContainerStyle={[\n { backgroundColor: colors.background },\n sceneContainerStyle,\n ]}\n />\n );\n}\n"]}
@@ -81,7 +81,7 @@ export declare type MaterialTopTabNavigationOptions = {
81
81
  /**
82
82
  * Function that returns a React element as the tab bar indicator.
83
83
  */
84
- tabBarIndicator?: (props: Omit<Parameters<React.ComponentProps<typeof TabBar>['renderIndicator']>[0], 'navigationState'> & {
84
+ tabBarIndicator?: (props: Omit<Parameters<NonNullable<React.ComponentProps<typeof TabBar>['renderIndicator']>>[0], 'navigationState'> & {
85
85
  state: TabNavigationState<ParamListBase>;
86
86
  }) => React.ReactNode;
87
87
  /**
@@ -148,6 +148,11 @@ export declare type MaterialTopTabNavigationOptions = {
148
148
  * but the user can still switch tabs by pressing the tab bar.
149
149
  */
150
150
  swipeEnabled?: boolean;
151
+ /**
152
+ * Whether to enable animations when switching between tabs by pressing on the tab bar or programmatically.
153
+ * Switching tab via swipe gesture will still result in an animation.
154
+ */
155
+ animationEnabled?: boolean;
151
156
  /**
152
157
  * Whether this screen should be lazily rendered. When this is set to `true`,
153
158
  * the screen will be rendered as it comes into the viewport.
@@ -177,7 +182,7 @@ export declare type MaterialTopTabNavigationOptions = {
177
182
  };
178
183
  export declare type MaterialTopTabDescriptor = Descriptor<MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
179
184
  export declare type MaterialTopTabDescriptorMap = Record<string, MaterialTopTabDescriptor>;
180
- export declare type MaterialTopTabNavigationConfig = Omit<TabViewProps<Route<string>>, 'navigationState' | 'onIndexChange' | 'onSwipeStart' | 'onSwipeEnd' | 'renderScene' | 'renderTabBar' | 'renderLazyPlaceholder' | 'swipeEnabled' | 'lazy' | 'lazyPreloadDistance' | 'lazyPlaceholder'> & {
185
+ export declare type MaterialTopTabNavigationConfig = Omit<TabViewProps<Route<string>>, 'navigationState' | 'onIndexChange' | 'onSwipeStart' | 'onSwipeEnd' | 'renderScene' | 'renderTabBar' | 'renderLazyPlaceholder' | 'swipeEnabled' | 'animationEnabled' | 'lazy' | 'lazyPreloadDistance' | 'lazyPlaceholder'> & {
181
186
  /**
182
187
  * Function that returns a React element to display as the tab bar.
183
188
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/material-top-tabs",
3
3
  "description": "Integration for the animated tab view component from react-native-tab-view",
4
- "version": "6.2.3",
4
+ "version": "6.3.0",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -45,16 +45,16 @@
45
45
  "warn-once": "^0.1.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@react-navigation/native": "^6.0.12",
48
+ "@react-navigation/native": "^6.0.13",
49
49
  "@testing-library/react-native": "^7.2.0",
50
- "@types/react": "^17.0.47",
51
- "@types/react-native": "~0.68.1",
50
+ "@types/react": "~18.0.0",
51
+ "@types/react-native": "~0.69.1",
52
52
  "del-cli": "^3.0.1",
53
- "react": "17.0.2",
54
- "react-native": "~0.68.2",
53
+ "react": "18.0.0",
54
+ "react-native": "0.69.5",
55
55
  "react-native-builder-bob": "^0.18.1",
56
- "react-native-pager-view": "5.4.15",
57
- "react-native-tab-view": "^3.1.1",
56
+ "react-native-pager-view": "5.4.24",
57
+ "react-native-tab-view": "^3.3.0",
58
58
  "typescript": "^4.7.4"
59
59
  },
60
60
  "peerDependencies": {
@@ -78,5 +78,5 @@
78
78
  ]
79
79
  ]
80
80
  },
81
- "gitHead": "83aa392f1e13796d609c9df0afa44699ce4bacae"
81
+ "gitHead": "a2e5f45c0ec603bb276c2e27595b4137fa3a85eb"
82
82
  }
package/src/types.tsx CHANGED
@@ -116,7 +116,9 @@ export type MaterialTopTabNavigationOptions = {
116
116
  */
117
117
  tabBarIndicator?: (
118
118
  props: Omit<
119
- Parameters<React.ComponentProps<typeof TabBar>['renderIndicator']>[0],
119
+ Parameters<
120
+ NonNullable<React.ComponentProps<typeof TabBar>['renderIndicator']>
121
+ >[0],
120
122
  'navigationState'
121
123
  > & { state: TabNavigationState<ParamListBase> }
122
124
  ) => React.ReactNode;
@@ -200,6 +202,12 @@ export type MaterialTopTabNavigationOptions = {
200
202
  */
201
203
  swipeEnabled?: boolean;
202
204
 
205
+ /**
206
+ * Whether to enable animations when switching between tabs by pressing on the tab bar or programmatically.
207
+ * Switching tab via swipe gesture will still result in an animation.
208
+ */
209
+ animationEnabled?: boolean;
210
+
203
211
  /**
204
212
  * Whether this screen should be lazily rendered. When this is set to `true`,
205
213
  * the screen will be rendered as it comes into the viewport.
@@ -251,6 +259,7 @@ export type MaterialTopTabNavigationConfig = Omit<
251
259
  | 'renderTabBar'
252
260
  | 'renderLazyPlaceholder'
253
261
  | 'swipeEnabled'
262
+ | 'animationEnabled'
254
263
  | 'lazy'
255
264
  | 'lazyPreloadDistance'
256
265
  | 'lazyPlaceholder'
@@ -64,6 +64,7 @@ export default function MaterialTopTabView({
64
64
  lazy={({ route }) => descriptors[route.key].options.lazy === true}
65
65
  lazyPreloadDistance={focusedOptions.lazyPreloadDistance}
66
66
  swipeEnabled={focusedOptions.swipeEnabled}
67
+ animationEnabled={focusedOptions.animationEnabled}
67
68
  onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}
68
69
  onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}
69
70
  sceneContainerStyle={[