mercredi 22 juillet 2020

animated component testing with react native testing library throws error "Cannot convert undefined or null to object at slice (

My floating textInput component is running fine in app but while testing with RNTL I am getting TypeError. How can I debug this error ?

TypeError: Cannot convert undefined or null to object
        at slice (<anonymous>)

      82 |                 duration: isFocused || value !== '' ? 400 : 0,
      83 |                 easing: Easing.linear,
    > 84 |             }).start();
         |                ^
      85 |         }

here is my effect hook in component

useEffect(() => {
    if (floatingLabel) {
      Animated.timing(textAnimation, {
        toValue: isFocused || value !== '' ? 1 : 0,
        duration: isFocused || value !== '' ? 400 : 0,
        easing: Easing.linear,
      }).start()
    }
  }, [isFocused, textAnimation, value, type, floatingLabel])

Thanks

Aucun commentaire:

Enregistrer un commentaire