farmcommand2 farmcommand2 - 8 months ago 46
React JSX Question

what numbers instead of zero can i use at `Animated.ValueXY(100, 100);`

when I use

as initial values for
at new
Animated.ValueXY(100, 100);
i get this error

Error: AnimatedValueXY must be initalized with an object of numbers or AnimatedValues.

but when i set them to 0 they or just pass nothing it works fine.

Answer Source

Animated.ValueXY(..) expects an object of numbers or AnimatedValues like the error says. To use different values then 0 you need to give them as an object.

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

When you use Animated.ValueXY(0 ,0) it might be taking 0 as a falsey and using the default values like you initiated it like Animated.ValueXY(). This is just a guess though. Maybe someone with more info can give it a better explanation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download