【发布时间】:2023-01-12 08:23:53
【问题描述】:
在我的本机反应应用程序中,我想要一个圆形脉冲动画循环,我仍然是一个使用动画 API 的菜鸟,我在标题中遇到错误。
我的代码。
const animatedValue = useRef(new Animated.Value(0)).current;
const onPressIn = ()=>{
Animated.loop([
Animated.timing(animatedValue, {
toValue: 2.2,
duration: 2000,
useNativeDriver:true,
}),
Animated.timing(animatedValue, {
toValue: 0.9,
duration: 700,
useNativeDriver:true,
})
],{useNativeDriver:true}).start()
};
<Animated.View style={{width:70,height:70,borderRadius:70/2,backgroundColor:'red',transform:[{scale:animatedValue}], position:'absolute',top:10,right:10,zIndex:9999999999}} >
</Animated.View>
当我从函数中删除 useNativeDriver 时,错误消失了......
【问题讨论】:
标签: reactjs react-native