0Pricing
React Native Academy · 강의

하단 탭 내비게이터

세 개의 탭이 있는 하단 탭 내비게이터를 만들고 벡터 아이콘 라이브러리로 각 탭의 아이콘을 사용자 지정하며 활성 색상을 설정합니다.

하단 탭 내비게이터은(는) CoddyKit의 무료 React Native Academy 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 React Native Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. React Native Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

What is a Bottom Tab Navigator?

A bottom tab navigator renders a tab bar at the bottom of the screen with one tab per registered screen. Tapping a tab switches to that screen. This pattern is very common in mobile apps (Instagram, Twitter, Airbnb) and is provided by the @react-navigation/bottom-tabs package.

Installing the Bottom Tabs Package

Install the bottom tabs navigator package separately from the React Navigation core. If you are using Expo, also make sure react-native-screens and react-native-safe-area-context are already installed from the previous setup step.

npm install @react-navigation/bottom-tabs

Creating the Tab Navigator

Call createBottomTabNavigator() to get a Tab object with Tab.Navigator and Tab.Screen components. Register screens exactly as you would in a stack navigator. Each Tab.Screen name becomes the default tab label.

import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';

const Tab = createBottomTabNavigator();

function MyTabs() {
  return (
    <Tab.Navigator>
      <Tab.Screen name='Home' component={HomeScreen} />
      <Tab.Screen name='Search' component={SearchScreen} />
      <Tab.Screen name='Profile' component={ProfileScreen} />
    </Tab.Navigator>
  );
}

Adding Icons to Tab Screens

Each tab should have an icon to help users recognize it quickly. Use tabBarIcon inside the screen's options prop. The render function receives a focused boolean and a color so you can render different icons or colors for active vs inactive tabs.

import { Ionicons } from '@expo/vector-icons';

<Tab.Screen
  name='Home'
  component={HomeScreen}
  options={{
    tabBarIcon: ({ focused, color, size }) => (
      <Ionicons
        name={focused ? 'home' : 'home-outline'}
        size={size}
        color={color}
      />
    ),
  }}
/>

Customizing Active and Inactive Colors

Set tabBarActiveTintColor and tabBarInactiveTintColor in screenOptions to control the color of tab icons and labels for the selected and unselected states. These color values are passed into the tabBarIcon render function automatically.

<Tab.Navigator
  screenOptions={{
    tabBarActiveTintColor: '#6200ee',
    tabBarInactiveTintColor: '#888',
  }}
>

Hiding the Tab Bar on Specific Screens

Sometimes you want to hide the tab bar when navigating to a detail screen. Set tabBarStyle: { display: 'none' } in the screen's options or use the navigation prop to toggle it dynamically with navigation.setOptions.

<Tab.Screen
  name='Details'
  component={DetailsScreen}
  options={{ tabBarStyle: { display: 'none' } }}
/>

Changing Tab Label and Badge

Override the tab label with tabBarLabel in the screen options. Add a notification badge using tabBarBadge to show a count indicator on the icon — useful for messaging or notification tabs. Set tabBarBadge to a number or string.

<Tab.Screen
  name='Messages'
  component={MessagesScreen}
  options={{
    tabBarLabel: 'Inbox',
    tabBarBadge: 3,
  }}
/>

Styling the Tab Bar Background

Customize the tab bar background color and border using tabBarStyle in screenOptions. You can set backgroundColor, borderTopColor, elevation (Android shadow), and height to match your design system.

<Tab.Navigator
  screenOptions={{
    tabBarStyle: {
      backgroundColor: '#1a1a2e',
      borderTopColor: '#333',
      height: 60,
    },
    tabBarLabelStyle: { fontSize: 12, paddingBottom: 4 },
  }}
>

Navigating Between Tabs Programmatically

Use navigation.navigate('TabName') to switch to a specific tab from any screen within the navigator. This is useful when a button action in one tab should take the user to another section of the app. The active tab's state is preserved.

function HomeScreen({ navigation }) {
  return (
    <Button
      title='Go to Profile'
      onPress={() => navigation.navigate('Profile')}
    />
  );
}

Listening to Tab Press Events

Use the tabPress event on navigation to intercept a tab press. This is useful for scrolling a list back to the top when the user taps the active tab. Call e.preventDefault() if you want to handle the press yourself without the default navigation action.

navigation.addListener('tabPress', (e) => {
  // Prevent default behavior
  e.preventDefault();
  // Custom action: scroll to top, show modal, etc.
});

Nesting a Stack Inside a Tab

In real apps each tab often contains its own stack of screens. Simply nest a Stack.Navigator as the component for a Tab.Screen. The stack renders inside the tab area while the tab bar remains visible at the bottom of the screen.

function HomeStack() {
  return (
    <Stack.Navigator>
      <Stack.Screen name='Home' component={HomeScreen} />
      <Stack.Screen name='Post' component={PostScreen} />
    </Stack.Navigator>
  );
}

<Tab.Screen name='HomeTab' component={HomeStack} />

Quick Check

Test your understanding of Bottom Tab Navigator concepts from this lesson.

Lesson Recap

In this lesson you learned: install and create a bottom tab navigator with createBottomTabNavigator, add icons using tabBarIcon in screen options, and customize colors, labels, and badges globally via screenOptions. Next up we explore the Drawer Navigator and nested navigators.

자주 묻는 질문

“하단 탭 내비게이터” 강의는 무료인가요?

네 — “하단 탭 내비게이터” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 React Native Academy 강의 전체를 잠금 해제할 수 있습니다. React Native Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

“하단 탭 내비게이터”에서 뭘 배우나요?

세 개의 탭이 있는 하단 탭 내비게이터를 만들고 벡터 아이콘 라이브러리로 각 탭의 아이콘을 사용자 지정하며 활성 색상을 설정합니다. 브라우저에서 직접 실행하는 실습 코드로 React Native Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

React Native Academy을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 React Native Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.

“하단 탭 내비게이터” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 React Native Academy 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 React Native Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. React Navigation 설치 및 구성
  2. 화면 간 이동과 매개변수 전달
  3. 하단 탭 내비게이터
  4. 서랍 내비게이터와 중첩 내비게이터
← React Native Academy(으)로 돌아가기