Socket
Socket
Sign inDemoInstall

react-animate-hoc

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-animate-hoc

Higher-order component easing/animating prop changes for React


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

react-animate-hoc

Higher-order component easing/animating prop changes for React

NPM

Demo

Live demo is available https://mleko.gitlab.io/react-animate-hoc/

Installation

Library can be installed via npm.

$ npm install react-animate-hoc

Usage

Component you wish to animate

export function ColorBox(p: RgbColor): JSX.Element {
	let style = {
		height: 50,
		width: 50,
		backgroundColor: `rgb(${p.r.toFixed()},${p.g.toFixed()},${p.b.toFixed()}`,
		border: "1px black solid",
		display: "inline-block",
		margin: 3
	};
	return (<div style={style}/>);
}

to animate property transition wrap component in animate HOC

export const AnimatedColorBox = animate()(ColorBox)

or annotate new component

@animate()
export class AnnotatedColorBox extends React.Component<RgbColor, any> {
	public render(): JSX.Element {
		return (<ColorBox {...this.props}/>);
	}
}

Now you can use animated components just like regular one

    <ColorBox {...this.state}/>
    <AnimatedColorBox {...this.state}/>
    <AnnotatedColorBox {...this.state}/>

Running examples

Have node.js and npm installed.

  1. Clone this repo.
  2. Run npm install to get all dependencies.
  3. Run npm start to run Webpack dev server.

License (MIT)

Keywords

FAQs

Package last updated on 19 Mar 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc