Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!