@@ -77,6 +77,27 @@ const SettingsStackScreen = createNativeStackNavigator({
77
77
},
78
78
});
79
79
80
+ const Tab = createBottomTabNavigator ({
81
+ screens: {
82
+ Home: {
83
+ screen : HomeStackScreen,
84
+ options: {
85
+ headerShown: false ,
86
+ tabBarLabel: ' Home!' ,
87
+ },
88
+ },
89
+ Settings: {
90
+ screen : SettingsStackScreen,
91
+ options: {
92
+ headerShown: false ,
93
+ tabBarLabel: ' Settings!' ,
94
+ },
95
+ },
96
+ },
97
+ });
98
+
99
+ const Navigation = createStaticNavigation (Tab);
100
+
80
101
// codeblock-focus-start
81
102
82
103
const PERSISTENCE_KEY = ' NAVIGATION_STATE_V1' ;
@@ -111,25 +132,6 @@ export default function App() {
111
132
if (! isReady) {
112
133
return null ;
113
134
}
114
- const Tab = createBottomTabNavigator ({
115
- screens: {
116
- Home: {
117
- screen : HomeStackScreen,
118
- options: {
119
- headerShown: false ,
120
- tabBarLabel: ' Home!' ,
121
- },
122
- },
123
- Settings: {
124
- screen : SettingsStackScreen,
125
- options: {
126
- headerShown: false ,
127
- tabBarLabel: ' Settings!' ,
128
- },
129
- },
130
- },
131
- });
132
- const Navigation = createStaticNavigation (Tab);
133
135
134
136
return (
135
137
< Navigation
@@ -207,6 +209,23 @@ function SettingsStackScreen() {
207
209
);
208
210
}
209
211
212
+ function RootTabs () {
213
+ return (
214
+ < Tab .Navigator screenOptions= {{ headerShown: false }}>
215
+ < Tab .Screen
216
+ name= " Home"
217
+ component= {HomeStackScreen}
218
+ options= {{ tabBarLabel: ' Home!' }}
219
+ / >
220
+ < Tab .Screen
221
+ name= " Settings"
222
+ component= {SettingsStackScreen}
223
+ options= {{ tabBarLabel: ' Settings!' }}
224
+ / >
225
+ < / Tab .Navigator >
226
+ );
227
+ }
228
+
210
229
// codeblock-focus-start
211
230
212
231
const PERSISTENCE_KEY = ' NAVIGATION_STATE_V1' ;
@@ -252,18 +271,7 @@ export default function App() {
252
271
AsyncStorage .setItem (PERSISTENCE_KEY , JSON .stringify (state))
253
272
}
254
273
>
255
- < Tab .Navigator screenOptions= {{ headerShown: false }}>
256
- < Tab .Screen
257
- name= " Home"
258
- component= {HomeStackScreen}
259
- options= {{ tabBarLabel: ' Home!' }}
260
- / >
261
- < Tab .Screen
262
- name= " Settings"
263
- component= {SettingsStackScreen}
264
- options= {{ tabBarLabel: ' Settings!' }}
265
- / >
266
- < / Tab .Navigator >
274
+ < RootTabs / >
267
275
< / NavigationContainer>
268
276
);
269
277
}
0 commit comments