sbycrosz / react-native-credit-card-input

Easy, cross-platform credit-card input for your React Native Project! Start accepting payment 💰 in your app today!
MIT License
1.46k stars 699 forks source link

Warning: componentWillReceiveProps has been renamed #223

Closed marlon07021 closed 2 months ago

marlon07021 commented 2 years ago

Using CreditCardInput imported as follow

import { CreditCardInput } from "react-native-credit-card-input";

is giving me this:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.

Please update the following components: CCInput, CreditCardInput

dee-one commented 8 months ago

CCInput.js

 componentDidUpdate(prevProps) {
  const { status, value, onBecomeEmpty, onBecomeValid, field } = this.props;

  if (prevProps.value !== "" && value === "") onBecomeEmpty(field);
  if (prevProps.status !== "valid" && status === "valid") onBecomeValid(field);
}

CreditCardInput.js

componentDidUpdate(prevProps) {
    if (prevProps.focused !== this.props.focused) {
      this._focus(this.props.focused);
    }
  }