Skip to content

Commit 2b3a6ee

Browse files
committed
Avoid duplicate screen name warnings
1 parent 1a94f4c commit 2b3a6ee

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

static/examples/6.x/tab-based-navigation-stack.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from 'react';
2-
import { Button, Text, View } from 'react-native';
1+
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
32
import { NavigationContainer } from '@react-navigation/native';
43
import { createNativeStackNavigator } from '@react-navigation/native-stack';
5-
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
4+
import * as React from 'react';
5+
import { Button, Text, View } from 'react-native';
66

77
function DetailsScreen() {
88
return (
@@ -64,8 +64,8 @@ export default function App() {
6464
return (
6565
<NavigationContainer>
6666
<Tab.Navigator screenOptions={{ headerShown: false }}>
67-
<Tab.Screen name="Home" component={HomeStackScreen} />
68-
<Tab.Screen name="Settings" component={SettingsStackScreen} />
67+
<Tab.Screen name="HomeStack" component={HomeStackScreen} />
68+
<Tab.Screen name="SettingsStack" component={SettingsStackScreen} />
6969
</Tab.Navigator>
7070
</NavigationContainer>
7171
);

static/examples/7.x/tab-based-navigation-stack.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from 'react';
2-
import { Button, Text, View } from 'react-native';
1+
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
32
import { NavigationContainer } from '@react-navigation/native';
43
import { createNativeStackNavigator } from '@react-navigation/native-stack';
5-
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
4+
import * as React from 'react';
5+
import { Button, Text, View } from 'react-native';
66

77
function DetailsScreen() {
88
return (
@@ -64,8 +64,8 @@ export default function App() {
6464
return (
6565
<NavigationContainer>
6666
<Tab.Navigator screenOptions={{ headerShown: false }}>
67-
<Tab.Screen name="Home" component={HomeStackScreen} />
68-
<Tab.Screen name="Settings" component={SettingsStackScreen} />
67+
<Tab.Screen name="HomeStack" component={HomeStackScreen} />
68+
<Tab.Screen name="SettingsStack" component={SettingsStackScreen} />
6969
</Tab.Navigator>
7070
</NavigationContainer>
7171
);

versioned_docs/version-6.x/tab-based-navigation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function SettingsScreen({ navigation }) {
155155

156156
## A stack navigator for each tab
157157

158-
Usually tabs don't just display one screen &mdash; for example, on your Twitter feed, you can tap on a tweet and it brings you to a new screen within that tab with all of the replies. You can think of this as there being separate navigation stacks within each tab, and that's exactly how we will model it in React Navigation.
158+
Often tabs don't just display one screen &mdash; for example, on your Twitter feed, you can tap on a tweet and it brings you to a new screen within that tab with all of the replies. You can think of this as there being separate navigation stacks within each tab, and that's exactly how we will model it in React Navigation.
159159

160160
<samp id="tab-based-navigation-stack" />
161161

@@ -226,8 +226,8 @@ export default function App() {
226226
return (
227227
<NavigationContainer>
228228
<Tab.Navigator screenOptions={{ headerShown: false }}>
229-
<Tab.Screen name="Home" component={HomeStackScreen} />
230-
<Tab.Screen name="Settings" component={SettingsStackScreen} />
229+
<Tab.Screen name="HomeStack" component={HomeStackScreen} />
230+
<Tab.Screen name="SettingsStack" component={SettingsStackScreen} />
231231
</Tab.Navigator>
232232
</NavigationContainer>
233233
);

versioned_docs/version-7.x/tab-based-navigation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ function SettingsScreen() {
410410

411411
## A stack navigator for each tab
412412

413-
Usually tabs don't just display one screen &mdash; for example, on your Twitter feed, you can tap on a tweet and it brings you to a new screen within that tab with all of the replies. You can think of this as there being separate navigation stacks within each tab, and that's exactly how we will model it in React Navigation.
413+
Often tabs don't just display one screen &mdash; for example, on your Twitter feed, you can tap on a tweet and it brings you to a new screen within that tab with all of the replies. You can think of this as there being separate navigation stacks within each tab, and that's exactly how we will model it in React Navigation.
414414

415415
<samp id="tab-based-navigation-stack" />
416416

@@ -485,8 +485,8 @@ export default function App() {
485485
return (
486486
<NavigationContainer>
487487
<Tab.Navigator screenOptions={{ headerShown: false }}>
488-
<Tab.Screen name="Home" component={HomeStackScreen} />
489-
<Tab.Screen name="Settings" component={SettingsStackScreen} />
488+
<Tab.Screen name="HomeStack" component={HomeStackScreen} />
489+
<Tab.Screen name="SettingsStack" component={SettingsStackScreen} />
490490
</Tab.Navigator>
491491
</NavigationContainer>
492492
);

0 commit comments

Comments
 (0)