Skip to content

Commit f293b0c

Browse files
committed
add screen to screen component name
1 parent 4df7263 commit f293b0c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

versioned_docs/version-7.x/testing.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ import { Button, Text, View } from 'react-native';
9292
import { createNativeStackNavigator } from '@react-navigation/native-stack';
9393
import { useNavigation } from '@react-navigation/native';
9494

95-
const Profile = () => {
95+
const ProfileScreen = () => {
9696
const navigation = useNavigation();
9797
return (
9898
<View>
@@ -109,7 +109,7 @@ const Profile = () => {
109109
);
110110
};
111111

112-
const Settings = () => {
112+
const SettingsScreen = () => {
113113
return (
114114
<View>
115115
<Text>Settings Screen</Text>
@@ -119,8 +119,8 @@ const Settings = () => {
119119

120120
export const RootNavigator = createNativeStackNavigator({
121121
screens: {
122-
Profile,
123-
Settings,
122+
Profile: ProfileScreen,
123+
Settings: SettingsScreen,
124124
},
125125
});
126126
```
@@ -132,7 +132,7 @@ export const RootNavigator = createNativeStackNavigator({
132132
import { Button, Text, View } from 'react-native';
133133
import { createNativeStackNavigator } from '@react-navigation/native-stack';
134134

135-
const Profile = ({ navigation }) => {
135+
const ProfileScreen = ({ navigation }) => {
136136
return (
137137
<View>
138138
<Text>Profile Screen</Text>
@@ -148,7 +148,7 @@ const Profile = ({ navigation }) => {
148148
);
149149
};
150150

151-
const Settings = () => {
151+
const SettingsScreen = () => {
152152
return (
153153
<View>
154154
<Text>Settings Screen</Text>
@@ -160,8 +160,8 @@ export const RootNavigator = () => {
160160
const Stack = createNativeStackNavigator();
161161
return (
162162
<Stack.Navigator>
163-
<Stack.Screen name="Profile" component={Profile} />
164-
<Stack.Screen name="Settings" component={Settings} />
163+
<Stack.Screen name="Profile" component={ProfileScreen} />
164+
<Stack.Screen name="Settings" component={SettingsScreen} />
165165
</Stack.Navigator>
166166
);
167167
};
@@ -320,7 +320,7 @@ import {
320320
import { fireEvent, render, screen } from '@testing-library/react-native';
321321
import { Button, Text, View } from 'react-native';
322322

323-
const Profile = () => {
323+
const ProfileScreen = () => {
324324
const navigation = useNavigation();
325325
return (
326326
<View>
@@ -335,7 +335,7 @@ const Profile = () => {
335335

336336
let renderCounter = 0;
337337

338-
const Settings = () => {
338+
const SettingsScreen = () => {
339339
renderCounter++;
340340
return (
341341
<View>
@@ -346,8 +346,8 @@ const Settings = () => {
346346

347347
const Drawer = createDrawerNavigator({
348348
screens: {
349-
Profile,
350-
Settings,
349+
Profile: ProfileScreen,
350+
Settings: SettingsScreen,
351351
},
352352
});
353353

@@ -382,7 +382,7 @@ import {
382382
import { fireEvent, render, screen } from '@testing-library/react-native';
383383
import { Button, Text, View } from 'react-native';
384384

385-
const Profile = ({ navigation }) => {
385+
const ProfileScreen = ({ navigation }) => {
386386
return (
387387
<View>
388388
<Text>Profile Screen</Text>
@@ -396,7 +396,7 @@ const Profile = ({ navigation }) => {
396396

397397
let renderCounter = 0;
398398

399-
const Settings = () => {
399+
const SettingsScreen = () => {
400400
renderCounter++;
401401
return (
402402
<View>
@@ -410,8 +410,8 @@ const Drawer = createDrawerNavigator();
410410
const DrawerNavigation = () => {
411411
return (
412412
<Drawer.Navigator>
413-
<Drawer.Screen name="Profile" component={Profile} />
414-
<Drawer.Screen name="Settings" component={Settings} />
413+
<Drawer.Screen name="Profile" component={ProfileScreen} />
414+
<Drawer.Screen name="Settings" component={SettingsScreen} />
415415
</Drawer.Navigator>
416416
);
417417
};
@@ -455,7 +455,7 @@ import {
455455
import { act, fireEvent, render, screen } from '@testing-library/react-native';
456456
import { Button, Text, View } from 'react-native';
457457

458-
const Profile = () => {
458+
const ProfileScreen = () => {
459459
const navigation = useNavigation();
460460
return (
461461
<View>
@@ -470,7 +470,7 @@ const Profile = () => {
470470

471471
let renderCounter = 0;
472472

473-
const Settings = () => {
473+
const SettingsScreen = () => {
474474
renderCounter++;
475475
return (
476476
<View>
@@ -481,8 +481,8 @@ const Settings = () => {
481481

482482
const Drawer = createDrawerNavigator({
483483
screens: {
484-
Profile,
485-
Settings,
484+
Profile: ProfileScreen,
485+
Settings: SettingsScreen,
486486
},
487487
});
488488

@@ -523,7 +523,7 @@ import {
523523
import { act, fireEvent, render, screen } from '@testing-library/react-native';
524524
import { Button, Text, View } from 'react-native';
525525

526-
const Profile = ({ navigation }) => {
526+
const ProfileScreen = ({ navigation }) => {
527527
return (
528528
<View>
529529
<Text>Profile Screen</Text>
@@ -537,7 +537,7 @@ const Profile = ({ navigation }) => {
537537

538538
let renderCounter = 0;
539539

540-
const Settings = () => {
540+
const SettingsScreen = () => {
541541
renderCounter++;
542542
return (
543543
<View>
@@ -551,8 +551,8 @@ const Drawer = createDrawerNavigator();
551551
const DrawerNavigation = () => {
552552
return (
553553
<Drawer.Navigator>
554-
<Drawer.Screen name="Profile" component={Profile} />
555-
<Drawer.Screen name="Settings" component={Settings} />
554+
<Drawer.Screen name="Profile" component={ProfileScreen} />
555+
<Drawer.Screen name="Settings" component={SettingsScreen} />
556556
</Drawer.Navigator>
557557
);
558558
};
@@ -594,7 +594,7 @@ Let's add another button to the Profile screen, which uses `setTimeout`:
594594
<TabItem value="static" label="Static" default>
595595

596596
```js
597-
const Profile = () => {
597+
const ProfileScreen = () => {
598598
const navigation = useNavigation();
599599
return (
600600
<View>
@@ -621,7 +621,7 @@ const Profile = () => {
621621
<TabItem value="dynamic" label="Dynamic">
622622

623623
```js
624-
const Profile = ({ navigation }) => {
624+
const ProfileScreen = ({ navigation }) => {
625625
return (
626626
<View>
627627
<Text>Profile Screen</Text>

0 commit comments

Comments
 (0)