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-animated-colors

v1.0.11

Published

Animate between Background Colors super smoothly

Downloads

645

Readme

React Native Animated Colors

🚀 Elevate your React Native app's user interface with React Native Animated Colors – a powerful library that makes animating background colors a breeze, delivering a seamless and native-like experience for your users.

        

Key Features

  • Smooth Animations: Achieve silky-smooth background color transitions without compromising on performance.

  • No Native Driver Limitations: Bypass the limitations of useNativeDriver: true. Our library provides you with an intuitive solution for animating background colors, ensuring your app's visuals are always engaging.

  • Enhanced Visuals: Take your app's visual appeal to the next level with dynamic and eye-catching background animations. Captivate your users and keep them engaged with your content.

Installation

npm install react-native-animated-colors

Usage

import AnimatedColorView from 'react-native-animated-colors';

Properties

name | description | type | default :--------------------------- |:-------------------------------------- | ----------------:|:------------ colors | List of background colors | Array | [ ] activeIndex | Active index of color to be displayed | Number | 0 duration | Duration of animation on transition | Number | 500 easing | Animation easing function | EasingFunction | Easing.linear loop | Loop the background colors | Boolean | false startDelay | Loop start delay | Number | 0 animatedStyle | Animating view style | Object | {} style | Container view style | Object | {}

Usage

  • colors: An array of background colors that you want to animate. For example: ['green', 'blue', 'red'].

  • activeIndex: Set this property to the index of the color you want to be displayed initially. For example, if activeIndex is 0, setting it to 1 will transition the background color from green to blue.

  • duration: Specify the duration (in milliseconds) of the color transition animation.

  • easing: The easing function for the animation. You can use standard easing functions provided by React Native or provide your custom easing function.

  • loop: When set to true, the background color will loop through the provided colors.

  • startDelay: If you want to introduce a delay before animating the colors, set this property with the desired delay duration (in milliseconds).

  • animatedStyle: Use this property to define additional style properties for the animating view.

  • style: Set the style properties for the container view.

Example

import React, { useState } from 'react';
import { Button, StyleSheet, Text, View } from 'react-native';
import AnimatedColorView from 'react-native-animated-colors';

const TestAnimation = () => {
  const [activeIndex, setindex] = useState(0);
  const [loop, setLoop] = useState(false);
  return (
    <View style={styles.container}>
      <AnimatedColorView
        activeIndex={activeIndex}
        colors={['green', 'blue', 'red']}
        loop={loop}
        style={styles.containerStyle}
        animatedStyle={styles.animatedStyle}
        duration={500}
        // Supports all View Props
        onTouchStart={() => console.log('pressed')}
      >
        <Text style={styles.text}>ASWIN C</Text>
      </AnimatedColorView>

      {!loop && <View style={styles.btn}>
        <Button title="green" onPress={() => setindex(0)} />
        <Button title="blue" onPress={() => setindex(1)} />
        <Button title="red" onPress={() => setindex(2)} />
      </View>}
      <Button title={`loop (${loop})`} onPress={() => setLoop(val => !val)} />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center'
  },
  containerStyle: {
    height: 200,
    width: 200,
    alignItems: 'center',
    justifyContent: 'center',
    borderRadius: 20,
    backgroundColor: 'pink',
    marginBottom: 50,
  },
  animatedStyle: {
    borderWidth: 5,
    borderColor: 'grey',
    borderRadius: 100
  },
  text: {
    fontSize: 20,
  },
  btn: {
    width: '100%',
    flexDirection: 'row',
    justifyContent: 'space-evenly',
    marginBottom: 20
  },
});

export default TestAnimation;

Skelton Loader Example

import React from 'react';
import { View, StyleSheet } from 'react-native';
import AnimatedColorView from 'react-native-animated-colors';

export default function SkeltonLoader() {
  return (
    <View style={styles.container}>
      {[1, 2, 3, 4, 5].map((x, i) => (
        <AnimatedColorView
          key={x.toString()}
          style={styles.row}
          colors={['lightgrey', 'transparent']}
          loop={true}
          startDelay={i * 100}
        />
      ))}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 20
  },
  row: {
    height: 60,
    marginBottom: 10,
  },
});

Copyright and License

ISC License

Copyright Aswin C. All rights reserved.