Skip to content

Commit 340e87d

Browse files
authored
revert adding NavigationNativeContainer (react-navigation#603)
1 parent 4852dce commit 340e87d

File tree

3 files changed

+85
-79
lines changed

3 files changed

+85
-79
lines changed

docs/native-stack-navigator.md

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,18 @@ To use this navigator, import it from `@react-navigation/native-stack`:
3131
<samp id="simple-native-stack">
3232

3333
```js
34-
import { NavigationNativeContainer } from '@react-navigation/native';
3534
import { createNativeStackNavigator } from '@react-navigation/native-stack';
3635

3736
const Stack = createNativeStackNavigator();
3837

39-
export default function App() {
38+
function MyStack() {
4039
return (
41-
<NavigationNativeContainer>
42-
<Stack.Navigator>
43-
<Stack.Screen name="Home" component={Home} />
44-
<Stack.Screen name="Notifications" component={Notifications} />
45-
<Stack.Screen name="Profile" component={Profile} />
46-
<Stack.Screen name="Settings" component={Settings} />
47-
</Stack.Navigator>
48-
</NavigationNativeContainer>
40+
<Stack.Navigator>
41+
<Stack.Screen name="Home" component={Home} />
42+
<Stack.Screen name="Notifications" component={Notifications} />
43+
<Stack.Screen name="Profile" component={Profile} />
44+
<Stack.Screen name="Settings" component={Settings} />
45+
</Stack.Navigator>
4946
);
5047
}
5148
```
@@ -203,45 +200,42 @@ navigation.popToTop();
203200
<samp id="native-stack-with-options">
204201

205202
```js
206-
import { NavigationNativeContainer } from '@react-navigation/native';
207203
import { createNativeStackNavigator } from '@react-navigation/native-stack';
208204

209205
const Stack = createNativeStackNavigator();
210206

211-
export default function App() {
207+
function MyStack() {
212208
return (
213-
<NavigationNativeContainer>
214-
<Stack.Navigator
215-
initialRouteName="Home"
216-
screenOptions={{
217-
headerShown: false,
218-
headerTintColor: 'white',
219-
headerStyle: { backgroundColor: 'tomato' },
209+
<Stack.Navigator
210+
initialRouteName="Home"
211+
screenOptions={{
212+
headerShown: false,
213+
headerTintColor: 'white',
214+
headerStyle: { backgroundColor: 'tomato' },
215+
}}
216+
>
217+
<Stack.Screen
218+
name="Home"
219+
component={Home}
220+
options={{
221+
title: 'Awesome app',
220222
}}
221-
>
222-
<Stack.Screen
223-
name="Home"
224-
component={Home}
225-
options={{
226-
title: 'Awesome app',
227-
}}
228-
/>
229-
<Stack.Screen
230-
name="Profile"
231-
component={Profile}
232-
options={{
233-
title: 'My profile',
234-
}}
235-
/>
236-
<Stack.Screen
237-
name="Settings"
238-
component={Settings}
239-
options={{
240-
gestureEnabled: false,
241-
}}
242-
/>
243-
</Stack.Navigator>
244-
</NavigationNativeContainer>
223+
/>
224+
<Stack.Screen
225+
name="Profile"
226+
component={Profile}
227+
options={{
228+
title: 'My profile',
229+
}}
230+
/>
231+
<Stack.Screen
232+
name="Settings"
233+
component={Settings}
234+
options={{
235+
gestureEnabled: false,
236+
}}
237+
/>
238+
</Stack.Navigator>
245239
);
246240
}
247241
```

website/static/examples/next/native-stack-with-options.js

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,40 +37,46 @@ function Settings({ navigation }) {
3737

3838
const Stack = createNativeStackNavigator();
3939

40+
function MyStack() {
41+
return (
42+
<Stack.Navigator
43+
initialRouteName="Home"
44+
screenOptions={{
45+
headerShown: false,
46+
headerTintColor: 'white',
47+
headerStyle: { backgroundColor: 'tomato' },
48+
}}
49+
>
50+
<Stack.Screen
51+
name="Home"
52+
component={Home}
53+
options={{
54+
title: 'Awesome app',
55+
}}
56+
/>
57+
<Stack.Screen
58+
name="Profile"
59+
component={Profile}
60+
options={{
61+
title: 'My profile',
62+
}}
63+
/>
64+
<Stack.Screen
65+
name="Settings"
66+
component={Settings}
67+
options={{
68+
gestureEnabled: false,
69+
}}
70+
/>
71+
</Stack.Navigator>
72+
);
73+
}
74+
4075
export default function App() {
4176
enableScreens();
4277
return (
4378
<NavigationNativeContainer>
44-
<Stack.Navigator
45-
initialRouteName="Home"
46-
screenOptions={{
47-
headerShown: false,
48-
headerTintColor: 'white',
49-
headerStyle: { backgroundColor: 'tomato' },
50-
}}
51-
>
52-
<Stack.Screen
53-
name="Home"
54-
component={Home}
55-
options={{
56-
title: 'Awesome app',
57-
}}
58-
/>
59-
<Stack.Screen
60-
name="Profile"
61-
component={Profile}
62-
options={{
63-
title: 'My profile',
64-
}}
65-
/>
66-
<Stack.Screen
67-
name="Settings"
68-
component={Settings}
69-
options={{
70-
gestureEnabled: false,
71-
}}
72-
/>
73-
</Stack.Navigator>
79+
<MyStack />
7480
</NavigationNativeContainer>
7581
);
7682
}

website/static/examples/next/simple-native-stack.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,22 @@ function Settings() {
4343

4444
const Stack = createNativeStackNavigator();
4545

46+
function MyStack() {
47+
return (
48+
<Stack.Navigator>
49+
<Stack.Screen name="Home" component={Home} />
50+
<Stack.Screen name="Notifications" component={Notifications} />
51+
<Stack.Screen name="Profile" component={Profile} />
52+
<Stack.Screen name="Settings" component={Settings} />
53+
</Stack.Navigator>
54+
);
55+
}
56+
4657
export default function App() {
4758
enableScreens();
4859
return (
4960
<NavigationNativeContainer>
50-
<Stack.Navigator>
51-
<Stack.Screen name="Home" component={Home} />
52-
<Stack.Screen name="Notifications" component={Notifications} />
53-
<Stack.Screen name="Profile" component={Profile} />
54-
<Stack.Screen name="Settings" component={Settings} />
55-
</Stack.Navigator>
61+
<MyStack />
5662
</NavigationNativeContainer>
5763
);
5864
}

0 commit comments

Comments
 (0)