【问题标题】:TypeError: animation._isUsingNativeDriver is not a function. (In 'animation._isUsingNativeDriver()', 'animation._isUsingNativeDriver' is undefined)TypeError: animation._isUsingNativeDriver 不是函数。 (在 \'animation._isUsingNativeDriver()\' 中,\'animation._isUsingNativeDriver\' 未定义)
【发布时间】: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


    【解决方案1】:

    我推荐Animated.parallel

    【讨论】:

    • 您可能希望对您的提议提供更详细的解释。
    猜你喜欢
    • 1970-01-01
    • 2019-05-26
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多