nativescript-community / ui-lottie

NativeScript plugin to expose Airbnb Lottie
https://github.com/airbnb/lottie-android
Other
177 stars 57 forks source link

Svelte integration? #96

Open soundsystems opened 2 years ago

soundsystems commented 2 years ago

is it possible to integrate in s svelte native app?

farfromrefug commented 2 years ago

sure you just need to register the element following svelte-native doc (on my phone right now)

rakanus commented 2 years ago

Hello This is how you can make it work in svelte - native , it worked with :

import { registerNativeViewElement } from "svelte-native/dom";
registerNativeViewElement(
  "LottieView",
  () => require("@nativescript-community/ui-lottie").LottieView
);

Add it to your root APP.ts

Then you can directly use it in any .Svelte file in your project as this

  <stackLayout>
        <lottieView
          src="loading.json"
          height="100"
          loop="true"
          autoPlay="true"
          loaded="yourLoadedEvent"
        />
      </stackLayout>