• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

162
Views
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.

about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error