시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-native-loader`
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-loader/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.
설치
“설치” 섹션AI-Assisted Setup으로 플러그인을 설치할 수 있습니다. 다음 명령어로 AI 도구에 Capgo 스킬을 추가하세요:
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 아래 프롬프트를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-native-loader` plugin in my project.수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
-
패키지 설치
터미널 창 bun add @capgo/capacitor-native-loaderbunx cap sync -
JavaScript에서 native loader 표시하기
import { NativeLoader } from '@capgo/capacitor-native-loader';const { id } = await NativeLoader.show({style: 'siri',placement: 'fullscreen',message: 'Preparing workspace',colors: ['#71f6ff', '#8b5cf6', '#ff4ecd', '#fff7ad'],scrimColor: 'rgba(3, 7, 18, 0.42)',interactionMode: 'block',});await doExpensiveWork();await NativeLoader.hide({ id });
빠른 시작
“빠른 시작” 섹션import { NativeLoader } from '@capgo/capacitor-native-loader';
await NativeLoader.configure({ defaults: {} });예시: show
“예시: show” 섹션import { NativeLoader } from '@capgo/capacitor-native-loader';
const result = await NativeLoader.show();console.log(result);예시: update
제목이 “예: 업데이트”인 섹션import { NativeLoader } from '@capgo/capacitor-native-loader';
await NativeLoader.update({ id: 'id-123' });자주 하는 실수
“흔한 실수” 섹션- 한 번만 초기화: 앱 부트스트랩 시 setup을 실행하세요.
- 네이티브 동기화: 실행
bunx cap sync플러그인 업그레이드 후. - 신뢰할 수 있는 소스: 신뢰
src/definitions.tsGitHub 레포지토리에서.
기본값 설정
“기본값 설정” 섹션await NativeLoader.configure({ defaults: { style: 'orbit', placement: 'center', size: 96, colors: ['#38bdf8', '#a78bfa'], reducedMotion: 'system', interactionMode: 'passThrough', },});Chrome 스타일 상단 로더
“Chrome 스타일 Top Loader” 섹션사용 style: 'chrome' 익숙한 브라우저 상단 프로그레스 바를 사용하면서, 그 아래의 WebView는 계속 조작할 수 있어야 할 때 사용합니다.
const { id } = await NativeLoader.show({ style: 'chrome', placement: 'top', colors: ['#4285f4', '#34a853', '#fbbc05', '#ea4335'], thickness: 4, interactionMode: 'passThrough', webView: { mode: 'resize', insets: { top: 12 }, restoreOnHide: true, },});
await NativeLoader.hide({ id, restoreWebView: true });Siri V2 엣지 로더
“Siri V2 Edge Loader” 섹션사용 style: 'siri-v2' 로딩 상태를 중앙 카드 형태가 아닌, 앱 가장자리를 따라 흐르는 네이티브 풀스크린 컬러 모션으로 보여주고 싶을 때 사용합니다.
const { id } = await NativeLoader.show({ style: 'siri-v2', placement: 'fullscreen', colors: ['#71f6ff', '#8b5cf6', '#ff4ecd', '#fff7ad'], thickness: 10, scrimColor: 'rgba(3, 7, 18, 0.10)', interactionMode: 'passThrough',});
await NativeLoader.hide({ id });업데이트 진행 상황
“업데이트 진행률” 섹션const { id } = await NativeLoader.show({ style: 'ring', message: 'Uploading', progress: 0,});
for await (const progress of uploadFile(file)) { await NativeLoader.setProgress({ id, progress });}
await NativeLoader.hide({ id });WebView 크기 조정
“WebView 크기 조정” 섹션사용 setWebViewLayout 웹 콘텐츠가 계속 보이고 사용 가능한 상태에서 네이티브 로더가 화면 일부를 차지해야 할 때 사용합니다.
await NativeLoader.setWebViewLayout({ mode: 'inset', insets: { top: 96, bottom: 24 }, animated: true,});
await NativeLoader.show({ style: 'wave', placement: 'top', size: 72, message: 'Syncing', interactionMode: 'passThrough',});네이티브 영역이 사라지면 원래 레이아웃으로 복원하세요:
await NativeLoader.hideAll({ restoreWebView: true });Lottie 및 이미지 로더
“Lottie 및 이미지 로더” 섹션Lottie JSON 또는 이미지 에셋을 네이티브 앱에 번들로 포함하고 JavaScript에서 참조하세요.
await NativeLoader.show({ style: 'lottie', placement: 'center', asset: { type: 'lottie', source: 'rocket-loader.json', loop: true, },});await NativeLoader.show({ style: 'image', placement: 'bottom', asset: { type: 'image', source: 'loader-frame', },});Native Swift 호출
“Native Swift Calls” 섹션다른 iOS 플러그인도 공유 로더를 직접 호출할 수 있습니다.
import CapgoCapacitorNativeLoader
let id = NativeLoader.shared.show(options: [ "style": "siri", "placement": "fullscreen", "message": "Opening secure session", "interactionMode": "block"])
NativeLoader.shared.setProgress(id: id, progress: 0.6)NativeLoader.shared.hide(id: id)Native Kotlin 호출
“Native Kotlin Calls” 섹션다른 Android 플러그인도 Kotlin 또는 Java에서 public 객체를 호출할 수 있습니다.
import app.capgo.nativeloader.NativeLoader
val id = NativeLoader.show( activity = activity, options = mapOf( "style" to "orbit", "placement" to "fullscreen", "message" to "Loading profile", "interactionMode" to "block", ), webView = bridge.webView,)
NativeLoader.setProgress(id, 0.6)NativeLoader.hide(id)공통 옵션
“Common Options” 섹션| 옵션 | 유형 | 설명 |
|---|---|---|
style | 'siri' | 'siri-v2' | 'chrome' | 'orbit' | 'ring' | 'pulse' | 'dots' | 'bars' | 'wave' | 'halo' | 'lottie' | 'image' | 로더 렌더러 |
placement | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'fullscreen' | 'around' | 'custom' | 네이티브 서피스 위치 |
interactionMode | 'passThrough' | 'block' | 'loaderOnly' | 터치 처리 |
backgroundColor | string | 알파 포함 오버레이 색상 |
scrimColor | string | 전체 화면 또는 화면 주변 스크림 색상 |
colors | string[] | 로더 그라데이션 색상 |
progress | number | Determinate 값의 출처 0 대상 1 |
autoHide | number | 자동 숨김 전 밀리초 |
asset | object | Lottie 또는 이미지 에셋 소스 |
사용 reducedMotion: 'system' 사용자의 플랫폼 모션 설정을 따르도록.