🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-native-css-animations

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-css-animations

React Native CSS Animation presets for Reanimated 4

0.1.1
latest
Source
npm
Version published
Maintainers
0
Created
Source
header

Ready-to-use CSS Animation presets for React Native Reanimated

[!TIP] Since version 4.0, React Native Reanimated comes with a native support for CSS Animations and Transitions. Read the full announcement to learn more.

Installation

yarn add react-native-reanimated@next
yarn add react-native-css-animations

Usage

Spin

Add spin style object to an Animated component add a linear spinning animation. Great for loaders.

Spin animation demo
import { spin } from 'react-native-css-animations';
import Animated from 'react-native-reanimated';

function App() {
  return <Animated.View style={[styles.spinner, spin]} />;
}

Ping

Add ping style object to an Animated component to make the element scale and fade. Great for attention grabbing elements like notifications.

Ping animation demo
import { ping } from 'react-native-css-animations';
import Animated from 'react-native-reanimated';

function App() {
  return <Animated.View style={[styles.notification, ping]} />;
}

Pulse

Add pulse style object to an Animated component to make it fade in and out. Great for skeleton loaders.

Pulse animation demo
import { pulse } from 'react-native-css-animations';
import Animated from 'react-native-reanimated';

function App() {
  return <Animated.View style={[styles.skeleton, pulse]} />;
}

Bounce

Add bounce style object to an Animated component to make it bounce up and down. Great for scroll down indicators.

Bounce animation demo
import { bounce } from 'react-native-css-animations';
import Animated from 'react-native-reanimated';

function App() {
  return <Animated.View style={[styles.arrow, bounce]} />;
}

Shimmer

Add shimmer style object to an Animated component to make it animate from left to right indefinitely. Great for shimmer loading effect.

Shimmer animation demo

[!NOTE] The example video on the right uses @react-native-masked-view/masked-view and expo-linear-gradient, and thus doesn't work on the Web.

import { shimmer } from 'react-native-css-animations';
import Animated from 'react-native-reanimated';

function App() {
  return <Animated.View style={[styles.gradient, shimmer]} />;
}

Alternative API

The following animations are also available in a form of React Native components.

import {
  Spin,
  Ping,
  Pulse,
  Bounce,
  Shimmer,
} from 'react-native-css-animations';

function App() {
  return (
    <Bounce>
      <ArrowIcon />
    </Bounce>
  );
}

Customizing animation presets

You can customize the animation style objects by overriding the styles like so:

import { shimmer } from 'react-native-css-animations';
import Animated from 'react-native-reanimated';

function App() {
  return <Animated.View
    style={[
      styles.gradient,
      shimmer,
+      {
+        animationName: {
+          to: { transform: [{ translateX: '100%' }] },
+        },
+      },
    ]}
  >
}

Credits

  • The examples and animations were adopted from Tailwind CSS.

Keywords

react-native

FAQs

Package last updated on 22 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts