Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
Argument of type 'AnimatedValue<0>' is not assignable to parameter of type 'Value | ValueXY'

I was going through React Native documentation for Animation: https://reactnative.dev/docs/animated

And wrote this simple code

import {Animated as RNAnimated} from 'react-native'
 
const ToastGeneric = () => {
  const windowHeight =  useWindowDimensions().height
  const modalPositionY = React.useRef(new Animated.Value(0)).current;
  const ToastStyleContainer: Record<ToastPosition, ViewStyle> = {
  bottom: {
    bottom: 0,
    marginBottom: bottomSafeArea,
  },
  top: {
    top: 0,
    marginTop: topSafeArea,
  }
 };
  useEffect(() => {
    if (toast.visible) {
      RNAnimated.timing(modalPositionY, {
        toValue: topSafeArea,
        duration: 2000
      }).start();

      setTimeout(() => {
        RNAnimated.timing(modalPositionY, {
          toValue: 0,
          duration: 2000
        }).start();
      }, 500)
    }

  }, [toast.visible])

but I keep getting this error here

  RNAnimated.timing(modalPositionY, {
    toValue: topSafeArea,
    duration: 2000
  }).start();

Argument of type 'AnimatedValue<0>' is not assignable to parameter of type 'Value | ValueXY'. Type 'AnimatedValue<0>' is missing the following properties from type 'Value': setOffset, flattenOffset, extractOffset, addListener, and 4 more.

Any idea what I could be doing wrong? when I launch the app, it crashed with this error

TypeError: singleValue.stopTracking is not a function. (In 'singleValue.stopTracking()', 'singleValue.stopTracking' is undefined)

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is a typo issue. React.useRef(new Animated.Value(0)).current; should be React.useRef(new RNAnimated.Value(0)).current; - RNAnimated instead of Animated.

You are already imported and renamed Animated to RNAnimated when you try to import Animated from react-native.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda