#navigationcontainer

질문 1
해시태그 없이 키워드만 일치하는 질문은 개수에 포함되지 않아요.

6달 전 · 유호준 님의 질문

NavigationContainer 중첩 오류

안녕하세요, RN(Expo)로 React Navigation을 적용하다 오류가 해결되지 않아서 질문드립니다. expo를 통해 다음과 같이 index.js에 React Navigation을 적용했습니다. import { store } from "@/redux/store"; import MainScreen from "./screens/MainScreen"; import { Provider } from "react-redux"; import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import LoginScreen from "./screens/LoginScreen"; export default function HomeScreen() { const Stack = createNativeStackNavigator(); return ( <Provider store={store}> <NavigationContainer> <Stack.Navigator> <Stack.Screen name="Main" component={MainScreen} /> <Stack.Screen name="Login" component={LoginScreen} />{" "} </Stack.Navigator> </NavigationContainer> </Provider> ); } 그러나 다음과 같은 오류가 뜨며 빈화면만 보이더라구요ㅠ Error: Looks like you have nested a 'NavigationContainer' inside another. Normally you need only one container at the root of the app, so this was probably an error. If this was intentional, pass 'independent={true}' explicitly. Note that this will make the child navigators disconnected from the parent and you won't be able to navigate between them. 찾아보니 NavigationContainer가 중첩되었다는 것 같은데, 저는 계속해서 그대로 강의를 따라가고 있었고, 따로 NavigationContainer를 적용한 파일이 존재하지 않습니다 ㅠ 다음 속성을 추가해도 오류가 해결되지 않습니다 ㅠ 아마 어디선가 부모에서 NavigationContainer가 적용된 것 같은데 찾을 수가 없네요 ㅠㅠ independent={true} 조금 더 찾아보니 expo-router랑 충돌이 난 거일 수도 있다는데 정확하게 모르겠네요 ㅠ

개발자

#react-native

#react-navigation

#expo

#navigationcontainer

답변 0

댓글 0

조회 82

2년 전 · 강현구 님의 답변 업데이트

Stack과 tab버튼을 동시에 만들고싶어요.

App에서 navigationContainer로 묶으면 에러가 나는데 어떻게 해결하나요ㅠㅠ 쉬운 것 같은데 제 실력부족으로 계속 에러가 생깁니다 홈,카트,로그인 탭버튼을 만들고 로그인 탭버튼을 누르면 로그인 화면(Stack.screen) 로그인 화면에 있는 회원가입버튼을 누르면 회원가입화면(Stack.screen)이 나오게 하고싶습니다🥲

개발자

#react-native

답변 1

댓글 2

조회 108