mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-25 22:37:18 +10:00
Don't use componentWillReceiveProps
This commit is contained in:
parent
34c4903bad
commit
3720591dda
2 changed files with 6 additions and 6 deletions
|
|
@ -78,14 +78,14 @@ class TokenInputFieldComponent extends Component {
|
|||
this._isMounted = true;
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const countryChanged = nextProps.country !== this.props.country;
|
||||
const currencyChanged = nextProps.currency !== this.props.currency;
|
||||
componentDidUpdate(prevProps) {
|
||||
const countryChanged = this.props.country !== prevProps.country;
|
||||
const currencyChanged = this.props.currency !== prevProps.currency;
|
||||
if (countryChanged || currencyChanged) {
|
||||
// Clear the possible input values from the state
|
||||
// if the given country or currency changes.
|
||||
this.setState(this.initialState);
|
||||
nextProps.input.onChange('');
|
||||
this.props.input.onChange('');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ class ProfileSettingsFormComponent extends Component {
|
|||
this.submittedValues = {};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
componentDidUpdate(prevProps) {
|
||||
// Upload delay is additional time window where Avatar is added to the DOM,
|
||||
// but not yet visible (time to load image URL from srcset)
|
||||
if (this.props.uploadInProgress && !nextProps.uploadInProgress) {
|
||||
if (prevProps.uploadInProgress && !this.props.uploadInProgress) {
|
||||
this.setState({ uploadDelay: true });
|
||||
this.uploadDelayTimeoutId = window.setTimeout(() => {
|
||||
this.setState({ uploadDelay: false });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue