Anfangen
Ein Setup-Prompt mit den Installationsanweisungen und der vollständigen Markdown-Guideline für diesen Plugin kopieren.
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.
Abschnitt mit dem Titel "Installation"
Sie können unsere AI-gestützte Einrichtung verwenden, um das Plugin zu installieren. Fügen Sie die __CAPGO_KEEP_0__-Fähigkeiten Ihrem KI-Tool hinzu, indem Sie die folgende Befehlszeile verwenden:You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsInstallation
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-native-loader` plugin in my project.Wenn Sie eine manuelle Einrichtung bevorzugen, installieren Sie das Plugin, indem Sie die folgenden Befehle ausführen und die unten angegebenen Plattform-spezifischen Anweisungen befolgen:
-
Installieren Sie das Paket
Terminal-Fenster npm install @capgo/capacitor-native-loadernpx cap sync -
Ein natives Loader-Modul aus JavaScript anzeigen
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 });
Standardeinstellungen konfigurieren
Abschnitt mit dem Titel „Standardeinstellungen konfigurieren“await NativeLoader.configure({ defaults: { style: 'orbit', placement: 'center', size: 96, colors: ['#38bdf8', '#a78bfa'], reducedMotion: 'system', interactionMode: 'passThrough', },});Chrome-Stil-Top-Loader
Abschnitt mit dem Titel „Chrome-Stil-Top-Loader“Benutzen style: 'chrome' wenn Sie das bekannte Browser-Top-Progress-Balken und den WebView unten benutzen möchten.
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
Abschnitt mit dem Titel „Siri V2 Edge Loader”Benutzen style: 'siri-v2' wenn der Ladezustand ein natürlicher, vollbildschirmiger Farbeneffekt um die App-Kante sein sollte, anstatt ein zentriertes Karten-Element.
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 });Aktualisierungsfortschritt
Abschnitt mit dem Titel „Aktualisierungsfortschritt”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 });Die Größe des WebViews anpassen
Abschnitt mit dem Titel “Die WebView anpassen”Verwenden Sie setWebViewLayout wenn eine native Loader die Anzeige eines Teils der Bildschirmfläche übernehmen soll, während die Webinhalte sichtbar und nutzbar bleiben.
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',});Rufen Sie die ursprüngliche Anordnung wieder auf, wenn die native Oberfläche verschwunden ist:
await NativeLoader.hideAll({ restoreWebView: true });Lottie- und Bildlader
Abschnitt mit dem Titel “Lottie- und Bildlader”Bündeln Sie Lottie-JSON- oder Bilddateien in der native App und referenzieren Sie sie aus 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 Aufrufe
Abschnitt mit dem Titel “Native Swift Aufrufe”Sonstige iOS-Plugins können den gemeinsamen Loader direkt aufrufen.
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 Aufrufe
Abschnitt mit dem Titel “Native Kotlin Aufrufe”Sonstige Android-Plugins können die öffentliche Klasse von Kotlin oder Java aufrufen.
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)Gemeinsame Optionen
Abschnitt mit dem Titel “Gemeinsame Optionen”| Option | Typ | Beschreibung |
|---|---|---|
style | 'siri' | 'siri-v2' | 'chrome' | 'orbit' | 'ring' | 'pulse' | 'dots' | 'bars' | 'wave' | 'halo' | 'lottie' | 'image' | Loader-Renderer |
placement | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'fullscreen' | 'around' | 'custom' | Nativposition |
interactionMode | 'passThrough' | 'block' | 'loaderOnly' | Berührungshandling |
backgroundColor | string | Hintergrundfarbe einschließlich Alpha |
scrimColor | string | Vollbildschirm- oder Randbildschirm-Hintergrundfarbe |
colors | string[] | Loader-Gradientfarben |
progress | number | Bestimmter Wert von 0 bis 1 |
autoHide | number | Zurückversteckung in Millisekunden |
asset | object | Lottie- oder Bildassetquelle |
Verwenden Sie reducedMotion: 'system' um die Plattform-Bewegungseinstellungen des Benutzers zu respektieren.