@react-navigation/material-top-tabs 7.0.0-rc.26 → 7.0.0-rc.28

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.
@@ -6,7 +6,7 @@ import {
6
6
  useLocale,
7
7
  useTheme,
8
8
  } from '@react-navigation/native';
9
- import { type SceneRendererProps, TabView } from 'react-native-tab-view';
9
+ import { TabView } from 'react-native-tab-view';
10
10
 
11
11
  import type {
12
12
  MaterialTopTabBarProps,
@@ -32,15 +32,22 @@ export function MaterialTopTabView({
32
32
  state,
33
33
  navigation,
34
34
  descriptors,
35
- sceneContainerStyle,
36
35
  ...rest
37
36
  }: Props) {
38
37
  const { colors } = useTheme();
39
38
  const { direction } = useLocale();
40
39
 
41
- const renderTabBar = (props: SceneRendererProps) => {
40
+ const renderTabBar: React.ComponentProps<
41
+ typeof TabView<Route<string>>
42
+ >['renderTabBar'] = ({
43
+ /* eslint-disable @typescript-eslint/no-unused-vars */
44
+ navigationState,
45
+ options,
46
+ /* eslint-enable @typescript-eslint/no-unused-vars */
47
+ ...rest
48
+ }) => {
42
49
  return tabBar({
43
- ...props,
50
+ ...rest,
44
51
  state: state,
45
52
  navigation: navigation,
46
53
  descriptors: descriptors,
@@ -79,11 +86,22 @@ export function MaterialTopTabView({
79
86
  animationEnabled={focusedOptions.animationEnabled}
80
87
  onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}
81
88
  onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}
82
- sceneContainerStyle={[
83
- { backgroundColor: colors.background },
84
- sceneContainerStyle,
85
- ]}
86
89
  direction={direction}
90
+ options={Object.fromEntries(
91
+ state.routes.map((route) => {
92
+ const options = descriptors[route.key]?.options;
93
+
94
+ return [
95
+ route.key,
96
+ {
97
+ sceneStyle: [
98
+ { backgroundColor: colors.background },
99
+ options?.sceneStyle,
100
+ ],
101
+ },
102
+ ];
103
+ })
104
+ )}
87
105
  />
88
106
  );
89
107
  }