babel-plugin-animated-block

1.0.1 • Public • Published

babel-plugin-animated-block

Babel 6 plugin that simplify animated expressions in React Native. In usage it could compared to deprecated with keyword

Before:

  animate() {
    this.sampleValue.setValue(0.3);
    { // Animated
      sequence([
        timing(
          this.sampleValue,
          {
            toValue: 0.7,
          }
        ),
        spring(
          this.sampleValue,
          {
            toValue: 1.3,
            friction: 1,
            tension: 1
          }
        )
      ]).start();
    }
  }

After:

  animate() {
    this.sampleValue.setValue(0.3);
    Animated.sequence([
      Animated.timing(
        this.sampleValue,
        {
          toValue: 0.7,
        }
      ),
      Animated.spring(
        this.sampleValue,
        {
          toValue: 1.3,
          friction: 1,
          tension: 1
        }
      )
    ]).start();
  }

I'll happily accept PRs for any further improvements to the project!

Usage

Add to your babelrc:

{
  "env": {
    "test": {
      "plugins": ["babel-plugin-animated-block"]
    }
  }
}

Example

cd example
yarn
react-native run-android / react-native run-ios

Build production

In order to test you need to build your changes

yarn prepublish

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-animated-block

Weekly Downloads

17

Version

1.0.1

License

MIT

Unpacked Size

3.69 kB

Total Files

3

Last publish

Collaborators

  • osdnk