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

react-native-gif-controller-view

v0.0.3

Published

React-native-gif-controller-view is a React Native library that provides comprehensive controls for GIF playback, including play, pause, reverse playback, and color adjustments

Downloads

2

Readme

react-native-gif-controller-view

https://github.com/islandryu/react-native-gif-controller-view/assets/65934663/ca939c3d-8404-442d-b205-bd7b910208f7

Overview

GifControllerView is a component designed for advanced control and manipulation of GIF images in React Native applications. This component offers properties to modify GIF presentation styles, animation controls, and color mappings. Moreover, using the reference methods (GifControllerViewRef), developers can fetch detailed color statistics and frame-specific data for any GIF.

Installation

Make sure you've already set up React Native in your project. Then, install the GifControllerView component:

npm install react-native-gif-controller-view

Usage

Props

source (ImageSourcePropType)

The GIF image source.

style (StyleProp<ImageStyle>)

Styles the GifControllerView. This prop accepts all standard React Native ImageStyle properties.

colorMappings (Array of { from: string; to: string })

An array that defines the color transformation mappings. Each mapping transforms a color from a specified value to another value.

Example:

colorMappings={[
  { from: "#FFFFFF", to: "#000000" },
  // This mapping transforms all white colors in the GIF to black.
]}

isAnimating (boolean)

Controls the GIF's animation state. If true, the GIF animates. If false, it pauses.

isReverse (boolean)

If set to true, the GIF animates in reverse. If false, it animates normally.

speed (number)

Determines the GIF's playback speed. A value of 1 is the default speed, 2 would be twice as fast, and so on.

disableLoop (boolean)

Controls whether the GIF animation should loop or not. If set to true, the GIF will play only once and stop at the last frame. If false, the GIF will loop continuously.

Ref Methods

Using React's ref, you can access the following methods:

getAllColorCount(index: number)

Returns a promise that resolves to an array containing the count of all colors in a specified frame. Each entry in the array includes the color and its count.

Example:

const ref = useRef();

// ... Somewhere in your code:
const colorData = await ref.current?.getAllColorCount(0);

seekTo(index: number)

Navigates to a specified frame index in the GIF.

Example:

const ref = useRef();

// ... Somewhere in your code:
ref.current?.seekTo(5); // Jumps to the 6th frame (0-indexed).

getFrameData()

Returns a promise that resolves to an array containing data about each frame. Each entry in the array includes the delayTime (time delay before the next frame) and frameIndex (index of the frame).

Example:

const ref = useRef();

// ... Somewhere in your code:
const frameData = await ref.current?.getFrameData();

Example

import GifControllerView from 'react-native-gif-controller-view';

// In your render:
<GifControllerView
  source={require('./path_to_your_gif.gif')}
  style={{ width: 100, height: 100 }}
  colorMappings={[{ from: '#FFFFFF', to: '#000000' }]}
  isAnimating={true}
  isReverse={false}
  speed={1}
  ref={yourRef}
/>;

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library