Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

94
Vistas
Warning: componentWillReceiveProps is depreciated, need to find an alternative for this lifecycle method

This is my interface

    interface FloatingLabelState {
        paddingAnim: Animated.Value;
        opacityAnim: Animated.Value;
        useNativeDriver :boolean;
    }

This is my componentWillReceiveProps function

componentWillReceiveProps(newProps: FloatingLabelProps) {
        Animated.timing(this.state.paddingAnim, {
            toValue: newProps.visible ? 5 : 9,
            duration: 230,
            useNativeDriver:this.state.useNativeDriver
        }).start();
        return Animated.timing(this.state.opacityAnim, {
            toValue: newProps.visible ? 1 : 0,
            duration: 230,
            useNativeDriver:this.state.useNativeDriver
        }).start();
    }

With many resources, came to know that static getDerivedStateFromProps() would be an alternative, Can someone help me convert componentWillReceiveProps to getDerivedStateFromProps method.

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos