我try 使用转换X和转换Y转换视图时出现此错误
-
ExceptionsManager.js:173无法将类型为NSMuable数组的JSON值‘({转换X=0;转换Y=120;})’转换为CATransform3D.必须 for each Transform对象恰好指定一个属性.
Const BouneInUp:fc=({Child,teddyear})=>;{ Const bouneValue=new Animated.Value(120); Const shakeValue=new Animated.Value(0);
const animate = useCallback(() => { Animated.sequence([ Animated.delay(300), Animated.spring(bounceValue, { useNativeDriver: true, toValue: -10, velocity: 3, friction: 8, }), Animated.sequence([ Animated.timing(shakeValue, { toValue: 10, duration: 100, useNativeDriver: true }), Animated.timing(shakeValue, { toValue: -10, duration: 100, useNativeDriver: true }), Animated.timing(shakeValue, { toValue: 10, duration: 100, useNativeDriver: true }), Animated.timing(shakeValue, { toValue: 0, duration: 100, useNativeDriver: true }), ]), ]).start(); }, [bounceValue, shakeValue]); useEffect(() => { animate(); }, [teddyBear.id]); return ( <Animated.View style={[styles.subView, { transform: [{ translateY: bounceValue, translateX: shakeValue }] }]}> {children} </Animated.View> );
};