본문으로 건너뛰기

시작

@react-navigation/native 는 라우팅과 관련된 기능을 제공하는 라이브러리에요.

설치

yarn add @react-navigation/native

@react-navigation/native 는 아래의 패키지에 대한 의존성이 있어요.
아래의 패키지도 반드시 설치해야 해요.

yarn add react-native-screens react-native-safe-area-context

ios의 경우 pod install 명령 실행이 필요해요.

라이브러리 적용

@react-navigation/native 이용을 위해서는 NavigationContainer로 앱 전체를 감싸주어야 해요.


//...

const App = () => {
return (
<NavigationContainer>
{/** 스택 네비게이터 / 하단탭 네비게이터 / 드로어 네비게이터 등 **/}
</NavigationContainer>
)
}

//...