I've got a lottie animation that I trigger from a parent component, the problem is that for some reason the entire lottie component layer is clickable and initiates the animation.
This is the code code that I'm using:
constructor(props) {
super(props);
this.state = {
isStopped: true,
isPaused: false,
Animated: 0,
};
this.defaultOptions = {
loop: false,
autoplay: false,
animationData: animationData
};
}
clickHandler = () => {
this.setState({
isStopped: false,
Animated: 0
});
console.log("clicked");
};
render() {
return (
<div id="ethdrop">
<Lottie
className='animation-class'
options={this.defaultOptions}
isStopped={this.state.isStopped}
isPaused={this.state.isPaused}
Animated={this.state.Animated}
/>
</div>
);
}
This is how the dom looks like: 
I can't find anything that might be triggering this if any of you have any idea please let me know.
There is an undocumented property: isClickToPauseDisabled. When this is set to false (which is the default value), you can pause and resume your animation by clicking on it. If you don't want this to happen, set this property to true.
Example:
<Lottie options={this.defaultOptions}
...
isClickToPauseDisabled={true}
/>
Reference: https://github.com/chenqingspring/react-lottie/pull/54
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With