@@ -6,6 +6,7 @@ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
66
77const RootStack = createNativeStackNavigator ( ) ;
88const Tabs = createBottomTabNavigator ( ) ;
9+ const TabThreeStack = createNativeStackNavigator ( ) ;
910
1011function RootStackHost ( ) {
1112 return (
@@ -27,6 +28,12 @@ function RootStackHost() {
2728}
2829
2930function TabsHost ( ) {
31+ const navigation = useNavigation ( ) ;
32+
33+ React . useEffect ( ( ) => {
34+ navigation . preload ( 'RootSheet' ) ;
35+ } , [ navigation ] ) ;
36+
3037 return (
3138 < Tabs . Navigator >
3239 < Tabs . Screen name = "TabOne" component = { TabOne } />
@@ -63,6 +70,10 @@ function RootSheet() {
6370 < Text > RootSheet</ Text >
6471 < Button title = "Open TabTwo" onPress = { ( ) => navigation . navigate ( 'TabsHost' , { screen : 'TabTwo' } ) } />
6572 < Button title = "Open TabThree" onPress = { ( ) => navigation . navigate ( 'TabsHost' , { screen : 'TabThree' } ) } />
73+ < Button title = "Open TabThreeStackScreenOne" onPress = { ( ) => navigation . navigate ( 'TabsHost' , { screen : 'TabThree' , params : { screen : 'TabThreeStackScreenOne' } } ) } />
74+ < Button title = "Open TabThreeStackScreenTwo" onPress = { ( ) => navigation . navigate ( 'TabsHost' , { screen : 'TabThree' , params : { screen : 'TabThreeStackScreenTwo' } } ) } />
75+ < Button title = "Open TabThreeStackScreenOne OS" onPress = { ( ) => navigation . navigate ( 'TabThreeStackScreenOne' ) } />
76+ < Button title = "Open TabThreeStackScreenTwo OS" onPress = { ( ) => navigation . navigate ( 'TabThreeStackScreenTwo' ) } />
6677 </ View >
6778 ) ;
6879}
@@ -84,16 +95,45 @@ function TabTwo() {
8495}
8596
8697function TabThree ( ) {
98+ // return (
99+ // <View style={{ flex: 1, backgroundColor: 'darkgreen' }}>
100+ // <Text>TabThree</Text>
101+ // </View>
102+ // );
103+ return (
104+ < TabThreeStackHost />
105+ ) ;
106+ }
107+
108+ function TabThreeStackScreenOne ( ) {
87109 return (
88- < View style = { { flex : 1 , backgroundColor : 'darkgreen ' } } >
89- < Text > TabThree </ Text >
110+ < View style = { { flex : 1 , backgroundColor : 'orange ' } } >
111+ < Text > TabThreeStackScreenOne </ Text >
90112 </ View >
91113 ) ;
92114}
93115
116+ function TabThreeStackScreenTwo ( ) {
117+ return (
118+ < View style = { { flex : 1 , backgroundColor : 'lightblue' } } >
119+ < Text > TabThreeStackScreenTwo</ Text >
120+ </ View >
121+ ) ;
122+ }
123+
124+ function TabThreeStackHost ( ) {
125+ return (
126+ < TabThreeStack . Navigator >
127+ < TabThreeStack . Screen name = "TabThreeStackScreenOne" component = { TabThreeStackScreenOne } />
128+ < TabThreeStack . Screen name = "TabThreeStackScreenTwo" component = { TabThreeStackScreenTwo } />
129+ </ TabThreeStack . Navigator >
130+
131+ ) ;
132+ }
133+
94134function App ( ) {
95135 return (
96- < NavigationContainer >
136+ < NavigationContainer navigationInChildEnabled >
97137 < RootStackHost />
98138 </ NavigationContainer >
99139 ) ;
0 commit comments