Getting Started
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-native-navigation`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/native-navigation/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
-
__CAPGO_KEEP_0__ 패키지를 설치합니다.
터미널 창 npm i @capgo/capacitor-native-navigation -
__CAPGO_KEEP_1__을 동기화합니다.
터미널 창 npx cap sync -
__CAPGO_KEEP_2__을 설정합니다.
import { NativeNavigation } from '@capgo/capacitor-native-navigation';await NativeNavigation.configure({contentInsetMode: 'css',animationDuration: 360,colors: {tint: '#0f172a',inactiveTint: '#64748b',},}); -
__CAPGO_KEEP_3__을 렌더링합니다.
await NativeNavigation.setNavbar({title: 'Home',subtitle: 'Native chrome',transparent: true,backButton: { visible: false },rightItems: [{id: 'compose',title: 'Compose',icon: {svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>',},},],}); -
자연스러운 탭바 렌더링
await NativeNavigation.setTabbar({selectedId: 'home',labelVisibilityMode: 'selected',icons: true,colors: {dynamic: true,tint: '#0f172a',inactiveTint: '#64748b',},tabs: [{id: 'home',title: 'Home',icon: {svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 10.5 12 3l9 7.5"/><path d="M5 10v10h14V10"/></svg>',},},{id: 'settings',title: 'Settings',badge: '2',icon: {svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/></svg>',},},],}); -
자연스러운 인텐트 이벤트 처리
await NativeNavigation.addListener('navbarBack', () => {router.back();});await NativeNavigation.addListener('navbarItemTap', ({ id }) => {if (id === 'compose') router.push('/compose');});await NativeNavigation.addListener('tabSelect', ({ id }) => {router.push(`/${id}`);});
전환 흐름
전환 흐름자연스러운 전환은 일반 자바스크립트 경로 변경 transaction입니다.:
const transition = await NativeNavigation.beginTransition({ direction: 'forward',});
router.push('/detail');await router.ready?.();
await NativeNavigation.setNavbar({ title: 'Detail', backButton: { visible: true, title: 'Back' },});
await NativeNavigation.finishTransition({ id: transition.id, direction: 'forward',});줌 전환
자세한 설명카드-상세 또는 미디어-예고 흐름에서 줌 도우미를 사용하세요. 탭된 요소를 라우터가 콘텐츠를 변경하기 전에 전달하고, 상세 페이지가 준비되면 완료하세요.
import { beginZoomTransition, finishZoomTransition } from '@capgo/capacitor-native-navigation';
const card = document.querySelector('[data-message-card]');if (card) { const transition = await beginZoomTransition(card, { cornerRadius: 18 });
router.push('/message/42'); await router.ready?.();
await NativeNavigation.setNavbar({ title: 'Message', backButton: { visible: true, title: 'Inbox' }, });
await finishZoomTransition(undefined, { id: transition.id, cornerRadius: 18, });}Use with @capgo/capacitor-transitions
Use with @capgo/capacitor-transitions자연스러운 네비게이션을 위해 native navbar, tabbar, safe-area insets, native intent 이벤트를 사용하고 WebView 페이지 스택을 native chrome 아래에 사용하세요. @capgo/capacitor-transitions native chrome 아래의 WebView 페이지 스택을 사용하세요.
npm install @capgo/capacitor-native-navigation @capgo/capacitor-transitionsnpx cap sync두 패키지를 한 번에 초기화하세요:
import { NativeNavigation } from '@capgo/capacitor-native-navigation';import '@capgo/capacitor-transitions';import { initTransitions, setupRouterOutlet, setDirection } from '@capgo/capacitor-transitions/react';
initTransitions({ platform: 'auto' });
const outlet = document.querySelector('cap-router-outlet');if (outlet) { setupRouterOutlet(outlet, { platform: 'auto', swipeGesture: 'auto' });}
await NativeNavigation.configure({ contentInsetMode: 'css',});페이지에 초점을 맞추고 중복된 웹 바를 피하세요: cap-router-outlet 클립보드 복사
<cap-router-outlet platform="auto" swipe-gesture="auto"> <cap-page> <cap-content slot="content" fullscreen> <main class="page">Inbox content</main> </cap-content> </cap-page></cap-router-outlet>__CAPGO_KEEP_0__
async function openMessage(id: string) { setDirection('forward'); await router.push(`/messages/${id}`); await NativeNavigation.setNavbar({ title: 'Message', backButton: { visible: true, title: 'Inbox' }, });}
await NativeNavigation.addListener('navbarBack', () => { setDirection('back'); router.back();});
await NativeNavigation.addListener('tabSelect', ({ id }) => { setDirection('root'); router.push(`/${id}`);});라우트 변경 시 하나의 애니메이션 레이어를 선택하세요. 일반 페이지 푸시를 animate 하세요, 그리고 공유 요소나 줌 루트에만 Native Navigation의 줌 헬퍼를 사용하세요. @capgo/capacitor-transitions CSS insets
CSS insets
이 플러그인은 native bar의 크기를클립보드 복사 contentInsetMode: 'css'사용 가능한 변수: document.documentElement.
.page { padding-top: var(--cap-native-navigation-top); padding-bottom: var(--cap-native-navigation-bottom);}아이콘은 native UI에서 렌더링되므로 serializable해야 합니다. 플랫폼 간 SVG, 플랫폼 특정 SVG, SF Symbols, iOS에서 번들링된 이미지, Android drawable resource, 또는 Android에서 번들링된 이미지를 사용할 수 있습니다.
--cap-native-navigation-top--cap-native-navigation-right--cap-native-navigation-bottom--cap-native-navigation-left--cap-native-navbar-height--cap-native-tabbar-height
Copy to clipboard
Available variables:Icon descriptors
const icon = { svg: '<svg viewBox="0 0 24 24"><path d="M3 10.5 12 3l9 7.5"/></svg>', width: 24, height: 24, template: true, src: 'fallback_asset_name', ios: { svg: '<svg viewBox="0 0 24 24"><path d="M3 10.5 12 3l9 7.5"/></svg>', sfSymbol: 'house.fill', image: 'BundledAssetName', }, android: { svg: '<svg viewBox="0 0 24 24"><path d="M3 10.5 12 3l9 7.5"/></svg>', resource: 'ic_menu_view', image: 'bundled_drawable_name', },};Inline SVG가 일반 아이콘 세트인 Lucide 및 Feather와 같은 아이콘에 중점을 둔 서브셋을 지원합니다. path, line, polyline, polygon, circle. SVG 아이콘은 기본적으로 템플릿 이미지를 통해 렌더링되므로 원시 색상이 아이콘을 재색칠할 수 있습니다. rect사용자 정의 웹 컴포넌트 등록
섹션 제목: 사용자 정의 웹 컴포넌트
프레임워크에 독립적인 선언적 설정을 위해 패키지는 커스텀 엘리먼트를 등록할 수 있습니다.Copy to clipboard
import { defineNativeNavigationElements } from '@capgo/capacitor-native-navigation';
defineNativeNavigationElements();<cap-native-navigation-provider enabled="true" content-inset-mode="css"></cap-native-navigation-provider>
<cap-native-navbar title="Home" transparent right-items='[{"id":"compose","title":"Compose","icon":{"svg":"<svg viewBox=\"0 0 24 24\"><path d=\"M12 20h9\"/></svg>"}}]'></cap-native-navbar>
<cap-native-tabbar selected-id="home" tabs='[{"id":"home","title":"Home","icon":{"ios":{"sfSymbol":"house.fill"}}}]'></cap-native-tabbar>플랫폼 참고
플랫폼 참고 섹션- iOS 렌더링
UINavigationBar그리고UITabBar; iOS 26+에서 시스템 Liquid Glass 바 동작을 사용합니다. - Android는 AppCompat 툴바와 Material 하단 네비게이션을 렌더링합니다.
- 웹 폴백은 원래 네이티브 바를 그리지 않습니다. 대신 이벤트와 브라우저 개발을 위한 inset 변수를 반영합니다.
- 플러그인은 하나의 풀 스크린 Capacitor WebView를 유지합니다. 네이티브는 프레임, 바, 안전 영역 보고, 전환 셸을 소유합니다.
Getting Started에서 계속
Getting Started에서 계속 섹션Capacitor를 사용 중이라면 Getting Started To native 미디어 및 인터페이스 동작을 계획하고 연결하세요. Using @capgo/capacitor-native-navigation native 기능을 위한 Using @capgo/capacitor-native-navigation Using @capgo/capacitor-live-activities native 기능을 위한 Using @capgo/capacitor-live-activities @capgo/capacitor-live-activities @capgo/capacitor-live-activities의 implementation detail Using @capgo/capacitor-video-player native 기능을 위한 Using @capgo/capacitor-video-player @capgo/capacitor-video-player @capgo/capacitor-video-player의 implementation detail