Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在`Animated.ValueXY(100100)中,我可以使用哪些数字来代替零`_Reactjs_React Native - Fatal编程技术网

Reactjs 在`Animated.ValueXY(100100)中,我可以使用哪些数字来代替零`

Reactjs 在`Animated.ValueXY(100100)中,我可以使用哪些数字来代替零`,reactjs,react-native,Reactjs,React Native,当我在新动画中使用100作为ValueXY的初始值时。ValueXY100,100;我得到这个错误 Error: AnimatedValueXY must be initalized with an object of numbers or AnimatedValues. 但是,当我将它们设置为0时,它们要么什么也不传递,这样就可以了。需要一个数字对象,或者像错误所说的那样。若要使用不同的值,则需要将其作为对象指定为0 Animated.ValueXY({x:100, y: 100}) 当您

当我在新动画中使用100作为ValueXY的初始值时。ValueXY100,100;我得到这个错误

Error: AnimatedValueXY must be initalized with an object of numbers or AnimatedValues.
但是,当我将它们设置为0时,它们要么什么也不传递,这样就可以了。

需要一个数字对象,或者像错误所说的那样。若要使用不同的值,则需要将其作为对象指定为0

Animated.ValueXY({x:100, y: 100})

当您使用Animated.ValueXY0,0时,它可能会将0视为假值,并使用默认值,就像您使用Animated.ValueXY一样。不过这只是一个猜测。也许有更多信息的人可以给它一个更好的解释。

你能试试动画.ValueXY{x:100,y:100}@bennygenel-hmmm它成功了!!为什么,当我使用Animated.ValueXY0,0;它是有效的,但对于其他数字,我必须把x:和y:作为答案发布