React Native render error Value is undefined expected a object
Asked Answered
V

1

6

So I dont know why I am getting this weird error and I am unable to find any solution for it so plz help with me

Error enter image description here

enter image description here

Code

import React, { useRef, useState } from 'react'
  2 import Animated, { Easing, useAnimatedProps } from 'react-native-reanimated'
  3 import { Path, PathProps } from 'react-native-svg'
  4
  5 interface AnimatedStrokeProps extends PathProps {
  6   progress: Animated.SharedValue<number>
  7 }
  8
  9 const AnimatedPath = Animated.createAnimatedComponent(Path)
 10
 11 const AnimatedStroke = ({ progress, ...pathProps }: AnimatedStrokeProps) => {
 12   const [length, setLength] = useState(0)
 13   const ref = useRef<typeof AnimatedPath>(null)
 14   const animatedProps = useAnimatedProps(() => ({
 15     strokeDashoffset: Math.max(
 16       0,
 17       length - length * Easing.bezier(0.37, 0, 0.63, 1)(progress.value) - 0.1
 18     )
 19   }))
 20
 21   return (
 22     <AnimatedPath
 23       animatedProps={animatedProps}
 24       // @ts-ignore
 25       onLayout={() => setLength(ref.current!.getTotalLength())}
 26       // @ts-ignore
 27       ref={ref}
 28       strokeDasharray={length}
 29       {...pathProps}
 30     />
 31   )
 32 }
 33
 34 export default AnimatedStroke

So plz help me out i rlly rlly need help in it.

Venomous answered 26/1, 2022 at 8:57 Comment(0)
D
0

Update your react-native-reanimated version.In my case I have react-native-reanimated version 2.3.1 and rolling back to 2.2.4 version.After that I occurred that error

Drillmaster answered 9/5, 2022 at 11:59 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Piece

© 2022 - 2025 — McMap. All rights reserved.