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.
-
패키지를 설치
터미널 창 npm i @capgo/capacitor-native-navigation -
자연어 프로젝트 Sync
터미널 창 npx cap sync -
__CAPGO_KEEP_1__
import { NativeNavigation } from '@capgo/capacitor-native-navigation';await NativeNavigation.configure({contentInsetMode: 'css',animationDuration: 360,colors: {tint: '#0f172a',inactiveTint: '#64748b',},}); -
__CAPGO_KEEP_2__
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>',},},],}); -
__CAPGO_KEEP_3__
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>',},},],}); -
__CAPGO_KEEP_4__
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}`);});
__CAPGO_KEEP_5__
__CAPGO_KEEP_6____CAPGO_KEEP_7__
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, });}@capgo/capacitor-전환과 함께 사용하세요.
섹션 제목: @capgo/capacitor-전환과 함께 사용하세요.자연스러운 네비게이션을 위해 네이티브 네비게이션을 사용하세요. 네이티브 네비게이션은 네이티브 네비게이션 바, 탭 바, 안전 영역 인셋, 네이티브 인텐트 이벤트를 제공합니다. 또한 WebView 페이지 스택은 네이티브 크롬 아래에 있습니다. @capgo/capacitor-transitions 터미널 창
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',});__CAPGO_KEEP_0__ cap-router-outlet __CAPGO_KEEP_0__
<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}`);});__CAPGO_KEEP_0__ @capgo/capacitor-transitions __CAPGO_KEEP_0__
__CAPGO_KEEP_0__
__CAPGO_KEEP_0____CAPGO_KEEP_0__ contentInsetMode: 'css'__CAPGO_KEEP_0__ document.documentElement.
.page { padding-top: var(--cap-native-navigation-top); padding-bottom: var(--cap-native-navigation-bottom);}사용 가능한 변수:
--cap-native-navigation-top--cap-native-navigation-right--cap-native-navigation-bottom--cap-native-navigation-left--cap-native-navbar-height--cap-native-tabbar-height
아이콘 설명자
아이콘 설명자 제목아이콘은 native UI가 렌더링하기 때문에 serializable해야 합니다. cross-platform SVG, platform-specific SVG, SF Symbols, iOS에서 패키징된 이미지, Android drawable resources, 또는 Android에서 패키징된 이미지 중 하나를 사용할 수 있습니다.
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', },};인라인 SVG는 Lucide 및 Feather와 같은 일반 아이콘 세트에서 사용하는 아이콘에 집중된 서브셋을 지원합니다.: path, line, polyline, polygon, circle, rectSVG 아이콘은 기본적으로 템플릿 이미지로 렌더링되므로 native tint 색상이 그들을 재색칠할 수 있습니다.
선택적 웹 컴포넌트
선택적 웹 컴포넌트 제목패키지는 프레임워크에 독립적인 선언적 설정을위한 커스텀 엘리먼트를 등록할 수 있습니다.
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 렌더링
UINavigationBarandUITabBar; iOS 26+에서는 시스템 Liquid Glass 바 동작을 사용합니다. - 안드로이드는 AppCompat 툴바와 Material 하단 네비게이션을 렌더링합니다.
- 웹 fallback은 네이티브 바를 그리지 않습니다. 대신 이벤트와 브라우저 개발을 위한 inset 변수를 반영합니다.
- Capacitor 화면을 차지하는 웹뷰를 하나만 유지합니다. Native은 프레임, 바, 안전 영역 보고, 전환 셸을 소유합니다.
Getting Started에서 계속하기
Getting Started에서 계속하기란만약 __CAPGO_KEEP_0__을 사용하고 있다면 Getting Started를 사용하여 native 미디어 및 인터페이스 동작을 계획하고자 한다면 __CAPGO_KEEP_0__/__CAPGO_KEEP_1__-native-navigation과 연결하세요. Using @capgo/capacitor-native-navigation Using @capgo/capacitor-native-navigation의 native 기능을 사용하기 위해 Using @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities의 native 기능을 사용하기 위해 @capgo/capacitor-live-activities @capgo/capacitor-live-activities의 구현 세부 사항을 위해 Using @capgo/capacitor-video-player native 기능을 위해 @capgo/capacitor-video-player를 사용합니다. @capgo/capacitor-video-player @capgo/capacitor-video-player의 구현 세부 사항입니다.