TIL: RN | ReactNavigation / Nesting navigators (1) - 220915

Lumpen·2022년 9월 15일
0

ReactNavigation

목록 보기
6/14

Nesting navigator

네비게이터 중첩은 다른 네비게이터의 화면 내에 또 다른 네비게이터를 렌더링 하는 것을 의미한다

function Home() {
  return (
    <Tab.Navigator>
      <Tab.Screen name="Feed" component={Feed} />
      <Tab.Screen name="Messages" component={Messages} />
    </Tab.Navigator>
  );
}

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
          name="Home"
          component={Home}
          options={{ headerShown: false }}
        />
        <Stack.Screen name="Profile" component={Profile} />
        <Stack.Screen name="Settings" component={Settings} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

위의 예에서 Home component는 Tab 네비게이터를 포함한다
Home 구성 요소는 App 구성 요소의 내부 stack 탐색기에서 Home 화면에서도 사용된다
Tab navigator는 Stack.Navigator 안에 중첩되어 있다

profile
떠돌이 생활을 하는. 실업자는 아니지만, 부랑 생활을 하는

0개의 댓글