가이드
네이티브 로더에 대한 튜토리얼
Using @capgo/capacitor-native-loader
@capgo/capacitor-native-loader 설치
Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-native-loader
npm install @capgo/capacitor-native-loader
npx cap sync
Fullscreen Native Loader
import { NativeLoader } from '@capgo/capacitor-native-loader';
const { id } = await NativeLoader.show({
style: 'siri',
placement: 'fullscreen',
message: 'Preparing your session',
colors: ['#71f6ff', '#8b5cf6', '#ff4ecd', '#fff7ad'],
scrimColor: 'rgba(3, 7, 18, 0.42)',
interactionMode: 'block',
});
await initializeAppData();
await NativeLoader.hide({ id });
Edge Loader With WebView Resize
await NativeLoader.setWebViewLayout({
mode: 'inset',
insets: { top: 96 },
animated: true,
});
await NativeLoader.show({
style: 'wave',
placement: 'top',
message: 'Syncing changes',
interactionMode: 'passThrough',
});
WebView가 로드 완료되면 다시 복원합니다.
await NativeLoader.hideAll({ restoreWebView: true });
Chrome-Style Top Progress
CSS가 중량 작업 중에 애니메이션을 요청하지 않아도 브라우저와 같은 로딩 바를 위에 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 Edge Loader
Use siri-v2 fullscreen 네이티브 로더를 사용하여 화면의 Edge에 색상을 움직이는 동안 WebView가 보이는 동안.
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 });
Lottie Loader
await NativeLoader.show({
style: 'lottie',
placement: 'center',
asset: {
type: 'lottie',
source: 'loader.json',
loop: true,
},
});
시작 로더에 대한 Bundled assets는 네트워크 요청과 JavaScript 초기화 이전에 사용할 수 있기 때문에 가장 좋습니다.
Native Plugin Calls
플러그인은 다른 플러그인이 로더를 직접 표시하거나 숨기도록 노출하는 네이티브 API를 노출합니다.
Swift:
import CapgoCapacitorNativeLoader
let id = NativeLoader.shared.show(options: [
"style": "orbit",
"placement": "fullscreen",
"message": "Opening secure session"
])
NativeLoader.shared.hide(id: id)
Kotlin:
import app.capgo.nativeloader.NativeLoader
val id = NativeLoader.show(
activity = activity,
options = mapOf(
"style" to "orbit",
"placement" to "fullscreen",
"message" to "Loading profile",
),
webView = bridge.webView,
)
NativeLoader.hide(id)
용량있는 링크
- GitHub: https://github.com/Cap-go/capacitor-native-loader/
- 문서: /docs/plugins/native-loader/
capgo: capacitor-native-loader를 사용하여 계속
__CAPGO_KEEP_0__: __CAPGO_KEEP_1__-native-loader를 사용하는 경우 capgo: capacitor-native-loader를 사용하여 __CAPGO_KEEP_0__: __CAPGO_KEEP_1__-native-loader와 연결하여 capgo: capacitor-native-loader를 사용하여 구현 세부 정보를 확인하세요 __CAPGO_KEEP_0__: __CAPGO_KEEP_1__-native-loader를 사용하여 Getting Started 설치에 사용하기 위해 Using @capgo/capacitor-native-navigation 자연스러운 네이티브 크롬 및 WebView 레이아웃을 위해 Using @capgo/capacitor-transitions WebView 경로의 자연스러운 동작을 위해