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

@nithinpp69/react-native-animated-button

v2.1.0

Published

React Native animated button

Downloads

18

Readme

React Native Animated Button 🔥

license platforms Version npm

A simple and customizable React Native animated button component.

Demo

❤️ Try on Expo Snack

Prerequisites

⚠️ Peer Dependencies

This component has a peer dependency on react-native-reanimated-v2. react-native-reanimated-v2 has to be installed and linked into your project. Follow react-native-reanimated-v2 to install the dependency.

Installation

Supported version: react-native >= 0.59.0

npm install @nithinpp69/react-native-animated-button

or

yarn add @nithinpp69/react-native-animated-button

Example

without custom popup

import React from 'react';
import { Image, StyleSheet, Text, View } from 'react-native';
import AnimatedButton from '@nithinpp69/react-native-animated-button';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#171517',
    alignItems: 'center',
  },
  title: {
    color: 'white',
    fontWeight: 'bold',
    fontSize: 18,
    marginBottom: 15,
    textAlign: 'left',
    width: '90%',
  },
  image: { width: '90%', height: 250, borderRadius: 15 },
  row: {
    width: '90%',
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    paddingTop: 15,
  },
  courtesy: { color: 'white', fontSize: 15 },
  icon: { width: 35, height: 35 },
});

const App = () => {
  return (
    <View style={styles.container}>
      <Text style={styles.title}>Without Custom Popup</Text>
      <Image
        source={{
          uri: 'https://images.unsplash.com/photo-1634938971687-1082b4cb018c?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1170&q=80',
        }}
        style={styles.image}
      />
      <View style={styles.row}>
        <Text style={styles.courtesy}>
          Image courtesy : Unsplash and FlatIcon
        </Text>
        <AnimatedButton>
          <Image
            source={{
              uri: 'https://cdn-icons-png.flaticon.com/512/6685/6685820.png',
            }}
            style={styles.icon}
          />
        </AnimatedButton>
      </View>
    </View>
  );
};

export default App;

with custom popup

import React from 'react';
import { Image, StyleSheet, Text, View } from 'react-native';
import AnimatedButton from '@nithinpp69/react-native-animated-button';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#171517',
    alignItems: 'center',
  },
  title: {
    color: 'white',
    fontWeight: 'bold',
    fontSize: 18,
    marginBottom: 15,
    textAlign: 'left',
    width: '90%',
  },
  image: { width: '90%', height: 250, borderRadius: 15 },
  row: {
    width: '90%',
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    paddingTop: 15,
  },
  courtesy: { color: 'white', fontSize: 15 },
  flyingContainer: { color: 'white', fontSize: 18, fontWeight: 'bold' },
  icon: { width: 35, height: 35 },
});

const App = () => {
  return (
    <View style={styles.container}>
      <Text style={styles.title}>With Custom Popup</Text>
      <Image
        source={{
          uri: 'https://images.unsplash.com/photo-1634938971687-1082b4cb018c?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1170&q=80',
        }}
        style={styles.image}
      />
      <View style={styles.row}>
        <Text style={styles.courtesy}>
          Image courtesy : Unsplash and FlatIcon
        </Text>
        <AnimatedButton
          renderFlyingContainer={() => (
            <Text style={styles.flyingContainer}>+1</Text>
          )}
        >
          <Image
            source={{
              uri: 'https://cdn-icons-png.flaticon.com/512/6685/6685820.png',
            }}
            style={styles.icon}
          />
        </AnimatedButton>
      </View>
    </View>
  );
};

export default App;

with likes count

import React, { useState } from 'react';
import { Image, ImageBackground, StyleSheet, Text, View } from 'react-native';
import AnimatedButton from '@nithinpp69/react-native-animated-button';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#171517',
    alignItems: 'center',
  },
  title: {
    color: 'white',
    fontWeight: 'bold',
    fontSize: 18,
    marginBottom: 15,
    textAlign: 'left',
    width: '90%',
  },
  image: { width: '90%', height: 250, borderRadius: 15 },
  row: {
    width: '90%',
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    paddingTop: 15,
  },
  courtesy: { color: 'white', fontSize: 15 },
  flyingContainer: { color: 'white', fontSize: 18, fontWeight: 'bold' },
  icon: {
    width: 35,
    height: 35,
    alignItems: 'center',
    justifyContent: 'center',
  },
  likesCount: {
    color: 'black',
    fontSize: 18,
    fontWeight: 'bold',
  },
});

const App = () => {
  const [likeCount, setLikeCount] = useState(0);

  return (
    <View style={styles.container}>
      <Text style={styles.title}>With Likes Count</Text>
      <Image
        source={{
          uri: 'https://images.unsplash.com/photo-1634938971687-1082b4cb018c?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1170&q=80',
        }}
        style={styles.image}
      />
      <View style={styles.row}>
        <Text style={styles.courtesy}>
          Image courtesy : Unsplash and FlatIcon
        </Text>
        <AnimatedButton
          renderFlyingContainer={() => (
            <Text style={styles.flyingContainer}>+1</Text>
          )}
          onPress={() => {
            setLikeCount(count => count + 1);
          }}
        >
          <ImageBackground
            source={{
              uri: 'https://cdn-icons-png.flaticon.com/512/6685/6685820.png',
            }}
            style={styles.icon}
          >
            <Text style={styles.likesCount}>{likeCount}</Text>
          </ImageBackground>
        </AnimatedButton>
      </View>
    </View>
  );
};

export default App;

Props

| Prop | Description | Type | Default Value | Required | | :--------------------:|:-------------------------------------------------------------------------------------------:|:-----------------------------:|:-------------:|:--------:| | onPress | button onPress callback | Function | () => {} | false | | duration | animation duration | Number | 500 | false | | style | button container style | ViewStyle | {} | false | | disabled | enable or disable button. If disabled, onPress callback won't be executed | Boolean | false | false | | disabledStyle | extra styling when the button is disabled. For eg, decreased opacity, different color etc. | ViewStyle | {} | false | | direction | flying direction | 'up' or 'down' | 'up' | false | | children | children component | React.ReactNode | null | false | | renderFlyingContainer | function to render the flying container. If not given, will be replaced by children element | Function | () => null | false | | enableScaleAnimation | enable or disable button scale animation | Boolean | true | false | | position | flying container position based on the button element | 'left' or 'center' or 'right' | 'center' | false |
| animationEnabled | enable or disable button animation | Boolean | true | false |