npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lottie-reactxp

v1.1.1

Published

A ReactXP extension for Lottie from AirBnB

Downloads

13

Readme

Lottie React

Exposes Lottie as a ReactXP extension.

Lottie is an iOS, Android, and React Native library that renders After Effects animations in real time, allowing apps to use animations as easily as they use static images. There is also a variant that works in a browser.

The reason for creating this etension is because the existing SVG ReactXP extension provided by Microsft does not implement the complete set of SVG elements. Lottie avoids having to deal directly with SVG.

Getting Started (Development)

Its a prequisite to set up React Native if you intend on running the Lottie examples on IOS or Andoid. Install React Native CLI by following this guide. Follow the "Building Projects from Native Code" tab.

For development, lets start by installing the NPM dependencies and peer dependencies.

npm run dev:setup # run from the checkout location

The example Lottie components can be viewed using a Storybook. Storybook is a demo playground for React components.

If using the bundled Storybook - the Lottie RN Setup has already been done.

Finally, run the Storybook on either Web:

npm run storybook-web

and/or Native:

npm run storybook-native
npm run dev:ios
npm run dev:android

npm run build can be used to rebuild the source code.

Getting Started (Usage)

Npm install module from GitHub:

npm i lottie-reactxp --save

Next follow the Lottie RN Setup. Note, you can skip installing the lottie-react-native NPM module as it's a dependency of this module. You will still have to do the react native linking steps however.

You will also need to have your required peer dependencies. The recommended peer dependencies are:

  • "react-native-windows": ">= 0.33.0"
  • "react-native": ">= 0.51.0"
  • "react-dom": ">= 16.0.0"
  • "react": ">= 16.0.0"
  • "reactxp": ">= 0.46.3"

You should be able to use in your code:

import RX from 'reactxp';
import Lottie from 'lottie-reactxp';
import lottieData from './lottie-data.json';
...
render() {
    // state can be used to control the animation
    const { isStopped, duration } = this.state;
    return (
      <RX.View>
        <Lottie
          source={lottieData}
          isStopped={isStopped}
          height={400}
          width={400}
          duration={Number(duration)}
          onLoopComplete={() => { console.log('onLoopComplete'); }}
          onComplete={() => { console.log('onComplete'); }}
        />
      </RX.View>
    );
}

Available props:

| Name | Description | Type | Required | Default | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | -------- | --------- | | source | The Lottie data as a JSON file | object | Yes | - | | loop | Whether the animaiton will repeat indefinitly | bool | No | true | | isStopped | True will stop animation, false will continue animation. | bool | No | false | | duration | Amount of seconds to run animation for. Setting the duration to the same amount as the Lottie animation length will result in a "speed" of 1 being set on the Lottie renderer. | number | No | 1 | | width | Sets the px width of the container surrounding animation | number | No | undefined | | height | Sets the px height of the container surrounding animation | number | No | undefined | | style | passes style information down to the underlying Lottie control | object | No | {} | | onComplete | callback triggered when an animation has finished and loop is false. | func | No | () => {} | | onLoopComplete | callback triggered when an animation has finished and loop is true. | func | No | () => {} |

Found a bug?

Please raise an issue if you have problems.

Contributing

Im open to contributions and improvements. Please raise an issue to discuss.