我正在使用 reanimated 在模态中创建自定义警报,它可以正常工作,但是在该模态可见并且内容已更新但动画不起作用后,动画只会在开始时工作一次,
这是我的代码
componentDidUpdate() {
// stopClock(clock);
if (this.state.visible) {
block([
timing(this.val, {
toValue: 1,
duration: 100,
easing: Easing.inOut(Easing.ease),
}).start(),
spring(this.scale, {
toValue: 1,
damping: 12,
mass: 0.6,
stiffness: 150.6,
overshootClamping: false,
restSpeedThreshold: 0.1001,
restDisplacementThreshold: 0.001,
}).start(),
]);
} else {
block([
timing(this.val, {
toValue: 0,
duration: 0,
easing: Easing.inOut(Easing.ease),
}).start(),
spring(this.scale, {
toValue: 0,
damping: 12,
mass: 0.6,
stiffness: 150.6,
overshootClamping: false,
restSpeedThreshold: 0.001,
restDisplacementThreshold: 0.001,
}).start(),
]);
}
}