Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
slideAnimation() {
let toValue = this.props.visible ? 1 : 0;
// circle,cubic,ease,in,inOut,out,linear
return Animated.timing(this.translateX, { toValue: toValue, duration: 260, easing: Easing.inOut(Easing.ease) });
}
componentDidUpdate(prevProps: any, prevState: any) {
if (this.props.selected !== prevProps.selected) {
const duration = AnimationDuration
Animated.parallel([
Animated.timing(this.state.textOpacity, { toValue: 1, duration }),
Animated.timing(this.state.backgroundColor, { toValue: this.props.selected ? 1 : 0, duration }),
]).start(this.props.onSelectionAnimationFinished)
}
}
scaleAnimation() {
return Animated.timing(this.state.scale, { toValue: this.state.toScale, duration: 200 });
}
componentDidUpdate(prevProps: any, prevState: any) {
if (this.props.selected !== prevProps.selected) {
const duration = AnimationDuration
Animated.parallel([
Animated.timing(this.state.textOpacity, { toValue: 1, duration }),
Animated.timing(this.state.backgroundColor, { toValue: this.props.selected ? 1 : 0, duration }),
]).start(this.props.onSelectionAnimationFinished)
}
}
fadeAnimation() {
let toValue = this.props.visible ? 1 : 0;
return Animated.timing(this.opacity, { toValue: toValue, duration: 300 });
}