Skip to content

Commit 5b88c87

Browse files
committed
fix: move SceneMap outside of the component
1 parent 93b1888 commit 5b88c87

File tree

5 files changed

+33
-34
lines changed

5 files changed

+33
-34
lines changed

apps/example/src/Examples/FourTabs.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ interface Props {
1616
activeIndicatorColor?: ColorValue;
1717
}
1818

19+
const renderScene = SceneMap({
20+
article: Article,
21+
albums: Albums,
22+
contacts: Contacts,
23+
chat: Chat,
24+
});
25+
1926
export default function FourTabs({
2027
disablePageAnimations = false,
2128
scrollEdgeAppearance = 'default',
@@ -53,13 +60,6 @@ export default function FourTabs({
5360
},
5461
]);
5562

56-
const renderScene = SceneMap({
57-
article: Article,
58-
albums: Albums,
59-
contacts: Contacts,
60-
chat: Chat,
61-
});
62-
6363
return (
6464
<TabView
6565
sidebarAdaptable

apps/example/src/Examples/Labeled.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import { Albums } from '../Screens/Albums';
55
import { Contacts } from '../Screens/Contacts';
66
import { Chat } from '../Screens/Chat';
77

8+
const renderScene = SceneMap({
9+
article: Article,
10+
albums: Albums,
11+
contacts: Contacts,
12+
chat: Chat,
13+
});
14+
815
export default function LabeledTabs({
916
showLabels = true,
1017
}: {
@@ -36,13 +43,6 @@ export default function LabeledTabs({
3643
},
3744
]);
3845

39-
const renderScene = SceneMap({
40-
article: Article,
41-
albums: Albums,
42-
contacts: Contacts,
43-
chat: Chat,
44-
});
45-
4646
return (
4747
<TabView
4848
labeled={showLabels}

apps/example/src/Examples/SFSymbols.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { Albums } from '../Screens/Albums';
55
import { Contacts } from '../Screens/Contacts';
66
import { Platform } from 'react-native';
77

8+
const renderScene = SceneMap({
9+
article: Article,
10+
albums: Albums,
11+
contacts: Contacts,
12+
});
13+
814
const isAndroid = Platform.OS === 'android';
915

1016
export default function SFSymbols() {
@@ -38,12 +44,6 @@ export default function SFSymbols() {
3844
},
3945
]);
4046

41-
const renderScene = SceneMap({
42-
article: Article,
43-
albums: Albums,
44-
contacts: Contacts,
45-
});
46-
4747
return (
4848
<TabView
4949
sidebarAdaptable

apps/example/src/Examples/ThreeTabs.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { Article } from '../Screens/Article';
44
import { Albums } from '../Screens/Albums';
55
import { Contacts } from '../Screens/Contacts';
66

7+
const renderScene = SceneMap({
8+
article: Article,
9+
albums: Albums,
10+
contacts: Contacts,
11+
});
12+
713
export default function ThreeTabs() {
814
const [index, setIndex] = useState(1);
915
const [routes] = useState([
@@ -30,12 +36,6 @@ export default function ThreeTabs() {
3036
},
3137
]);
3238

33-
const renderScene = SceneMap({
34-
article: Article,
35-
albums: Albums,
36-
contacts: Contacts,
37-
});
38-
3939
return (
4040
<TabView
4141
navigationState={{ index, routes }}

apps/example/src/Examples/TintColors.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
import * as React from 'react';
21
import TabView, { SceneMap } from 'react-native-bottom-tabs';
32
import { useState } from 'react';
43
import { Article } from '../Screens/Article';
54
import { Albums } from '../Screens/Albums';
65
import { Contacts } from '../Screens/Contacts';
76
import { Chat } from '../Screens/Chat';
87

8+
const renderScene = SceneMap({
9+
article: Article,
10+
albums: Albums,
11+
contacts: Contacts,
12+
chat: Chat,
13+
});
14+
915
export default function TintColorsExample() {
1016
const [index, setIndex] = useState(0);
1117
const [routes] = useState([
@@ -38,13 +44,6 @@ export default function TintColorsExample() {
3844
},
3945
]);
4046

41-
const renderScene = SceneMap({
42-
article: Article,
43-
albums: Albums,
44-
contacts: Contacts,
45-
chat: Chat,
46-
});
47-
4847
return (
4948
<TabView
5049
sidebarAdaptable

0 commit comments

Comments
 (0)