내용으로 건너뛰기

시작하기

GitHub

AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 기능을 추가하려면 다음 명령어를 사용하세요:

터미널 창
npx 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.

만약 Manual Setup을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래에 플랫폼에 따라 설명된 지침을 따르면 됩니다.

  1. 패키지 설치

    터미널 창
    npm install @capgo/capacitor-native-loader
    npx cap sync
  2. JavaScript에서 네이티브 로더를 표시하세요

    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 });

기본값 구성

기본값 구성
await NativeLoader.configure({
defaults: {
style: 'orbit',
placement: 'center',
size: 96,
colors: ['#38bdf8', '#a78bfa'],
reducedMotion: 'system',
interactionMode: 'passThrough',
},
});

크롬 스타일 탑 로더

기본값 구성

사용 style: 'chrome' 웹뷰가 위에 있는 브라우저 상단 진행바와 함께 사용할 때

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 Edge Loader

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 });

사용 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 });

클립보드에 복사

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',
},
});

네이티브 스위프트 호출

네이티브 스위프트 호출

다른 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)

네이티브 코틀린 호출

네이티브 코틀린 호출

다른 안드로이드 플러그인은 코틀린 또는 자바에서 공유 객체를 호출할 수 있습니다.

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)

공통 옵션

공통 옵션
설정타입설명
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'터치 처리
backgroundColorstring투명도 포함 오버레이 색상
scrimColorstring스크린 전체 또는 화면 주변의 블러 색상
colorsstring[]로더 그라디언트 색상
progressnumber정확한 값 0 까지 1
autoHidenumber자동으로 숨기기 전까지의 밀리초
assetobject원본 Lottie 또는 이미지

사용 reducedMotion: 'system' 사용자 플랫폼의 동작 설정을 존중합니다.