React-native-animatable: Animations not working with custom components

Created on 11 Jan 2018  路  7Comments  路  Source: oblador/react-native-animatable

import * as Animatable from 'react-native-animatable';
MyCustomComponent = Animatable.createAnimatableComponent(MyCustomComponent);

Such method not work

Most helpful comment

Make sure that your component accepts a style prop and it is applied to your top-level view.
e.g

class MyCustomComponent extends React.PureComponent {
  render() {
    const { style } = this.props;
    return (
      <View style={style}>
        <Text>This is animating now</Text>
      </View>
    );
  }
}
const AnimatedComponent = Animatable.createAnimatableComponent(MyCustomComponent);

All 7 comments

+1

I am having the same issue on Android.

same issue here (on android)

Animatable uses Animated under the hood, so if your component doesn't support it, then Animatable won't either. You might try to add support for setNativeProps and see if that helps.

Ran into the same issue. The temporary solution is to create a custom component that is using Animatable.View (or whatever) so you don't have to use the provided function. Didn't look into the function yet, if I find the time I'll try to see what is going on.

same issue . you must put the update animation operation in the requestAnimationFrame.
But another problem is that when executed on a custom component, it is repeatedly render 18 times !!!

Make sure that your component accepts a style prop and it is applied to your top-level view.
e.g

class MyCustomComponent extends React.PureComponent {
  render() {
    const { style } = this.props;
    return (
      <View style={style}>
        <Text>This is animating now</Text>
      </View>
    );
  }
}
const AnimatedComponent = Animatable.createAnimatableComponent(MyCustomComponent);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sundayhd picture sundayhd  路  5Comments

hafiz703 picture hafiz703  路  5Comments

EdmundMai picture EdmundMai  路  3Comments

kamek-pf picture kamek-pf  路  8Comments

matheuscastroweb picture matheuscastroweb  路  6Comments