Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

react native - stack navigator seem to be stuck when nesting with drawer navigator

Currently i am developing a react native app which has multiple stack navigator nested inside a drawer navigator.The stack navigator screen getting stuck when switching from one stack navigator to another

import * as React from 'react';
import {
  Button,
  View,
  Text,
  TouchableOpacity,
  Image
} from 'react-native';

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createDrawerNavigator } from '@react-navigation/drawer';

import FirstPage from './pages/FirstPage';
import SecondPage from './pages/SecondPage';
import ThirdPage from './pages/ThirdPage';
import FourthPage from './pages/FourthPage';

const Stack = createStackNavigator();
const Stack1 = createStackNavigator();
const Drawer = createDrawerNavigator();

  

function firstScreenStack({ navigation }) {
  return (
      <Stack.Navigator initialRouteName="FirstPage">
        <Stack.Screen name="FirstPage" component={FirstPage}/>
        <Stack.Screen name="SecondPage" component={SecondPage}/>
      </Stack.Navigator>
  );
}

function secondScreenStack({ navigation }) {
  return (
    <Stack1.Navigator initialRouteName="SecondPage">
      <Stack1.Screen name="ThirdPage" component={ThirdPage}/>
      <Stack1.Screen name="FourthPage" component={FourthPage}/>
    </Stack1.Navigator>
  );
}

function App() {
  return (
    <NavigationContainer>
      <Drawer.Navigator>
        <Drawer.Screen
          name="FirstPage"
          component={firstScreenStack} />
        <Drawer.Screen
          name="SecondPage"
          component={secondScreenStack} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}

export default App;
question from:https://stackoverflow.com/questions/65858478/stack-navigator-seem-to-be-stuck-when-nesting-with-drawer-navigator

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...