🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@motiz88/animated-expr-test

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@motiz88/animated-expr-test

A tiny language for arithmetic over React Native's Animated values.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

animated-expr

A tiny language for arithmetic over React Native's Animated values.

JSanimated-expr
Animated.add(x, y)animated`${x} + ${y}`
Animated.multiply(x, y)animated`${x} * ${y}`
Animated.divide(x, y)animated`${x} / ${y}`
Animated.add(x, Animated.multiply(-1, y))animated`${x} - ${y}`
Animated.modulo(x, y)animated`${x} % ${y}`

Sample code

import { Animated } from "react-native";
import animated from "animated-expr";

const a = new Animated.Value(1);
const b = animated`1 / ${a}`;

Animated.spring(a, { toValue: 2 }).start();

Getting started

The recommended way of using this package is at compile time, via the included Babel plugin. Otherwise, you will end up compiling expressions at runtime, which is slower and likely not what you want for real-world use.

First, install the package:

npm install --save-dev animated-expr

Then, set up the Babel plugin by adding it to the plugins array in your .babelrc file. (If you don't have a .babelrc file yet, read this.)

.babelrc

{
  "presets": ["react-native"],
  "plugins": ["animated-expr/babel"]
}

Keywords

react-native

FAQs

Package last updated on 06 Feb 2018

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