我目前的问题是我的动画没有为id分配的正确激活:
anim_star = (id) => {
let progress = this.state.progress;
progress[id] = new Animated.Value(0);
this.setState({ progress });
console.log(this.state.progress);
Animated.timing(this.state.progress, {
toValue: 1,
duration: 2000,
easing: Easing.linear,
}).start();
}
结果console在这里:
在你看到的地方10: AnimatedValue,10代表id我为那个动画点击的那个。由于某种原因,动画没有播放10。
这是我尝试的尝试,并且(我猜)将正确的附加id到AnimatedValue:
<TouchableOpacity
onPress={this.anim_like.bind(this, item.id)}>
<Animation
progress={this.state.progress[item.id]} // Here is where I think I need to fix.
source={require('../Animations/favourite_app_icon.json')}
/>
</TouchableOpacity>
有没有办法嘲笑我在里面发生的事情console.log?
