React-native-animatable: How to restart animation on same component?

Created on 25 Nov 2017  路  1Comment  路  Source: oblador/react-native-animatable

I have an action bar with icons functioning as buttons as per this gif:
Alt Text

The animation works when the app loads, but when I click a button, and new buttons are loaded into the action bar, they are not animated as well, except for the last button.

I have tried the following:

  • In my constructor:
this.state = {
      startAnimation: true,
    };

and

componentDidUpdate() {
    if (this.state.startAnimation) {
      this.refs.animatable.pulse();
    }
  }

and on my animatable view (each button is rendered with one)
`ref='animatable'

  onAnimationEnd={({ finished }) => {
    if (finished) {
      this.setState({ startAnimation: true });
    }
  }}

`

Can anyone assist?

Most helpful comment

>All comments

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EdmundMai picture EdmundMai  路  3Comments

hafiz703 picture hafiz703  路  5Comments

zr0n picture zr0n  路  6Comments

ovaris picture ovaris  路  4Comments

Aspirationtocode picture Aspirationtocode  路  7Comments