mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#106: recalculate form height, after lang changed
This commit is contained in:
@@ -316,7 +316,7 @@ class PanelTransition extends Component {
|
||||
}
|
||||
|
||||
shouldMeasureHeight() {
|
||||
return '' + this.props.auth.error + this.state.isHeightDirty;
|
||||
return '' + this.props.auth.error + this.state.isHeightDirty + this.props.user.lang;
|
||||
}
|
||||
|
||||
getHeader({key, style, data}) {
|
||||
|
||||
@@ -22,6 +22,7 @@ export default class ChangeEmail extends Component {
|
||||
|
||||
static propTypes = {
|
||||
onChangeStep: PropTypes.func,
|
||||
lang: PropTypes.string.isRequired,
|
||||
email: PropTypes.string.isRequired,
|
||||
stepForms: PropTypes.arrayOf((propValue, key, componentName, location, propFullName) => {
|
||||
if (propValue.length !== 3) {
|
||||
@@ -161,7 +162,7 @@ export default class ChangeEmail extends Component {
|
||||
<MeasureHeight
|
||||
className={changeEmail.stepForm}
|
||||
onMeasure={this.onStepMeasure(step)}
|
||||
state={`${step}.${form.hasErrors()}`}
|
||||
state={`${step}.${form.hasErrors()}.${this.props.lang}`}
|
||||
key={step}
|
||||
>
|
||||
{this[`renderStep${step}`]({
|
||||
|
||||
@@ -52,8 +52,9 @@ export default class Form extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
if (nextProps.form && nextProps.form !== this.props.form) {
|
||||
throw new Error('The FormModel instance should not be changed during component lifetime');
|
||||
if (nextProps.form && this.props.form && nextProps.form !== this.props.form) {
|
||||
this.props.form.removeLoadingListener(this.onLoading);
|
||||
nextProps.form.addLoadingListener(this.onLoading);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,10 +105,16 @@ export default class FormModel {
|
||||
}
|
||||
|
||||
beginLoading() {
|
||||
this.handlers.forEach((fn) => fn(true));
|
||||
this._isLoading = true;
|
||||
this.notifyHandlers();
|
||||
}
|
||||
|
||||
endLoading() {
|
||||
this.handlers.forEach((fn) => fn(false));
|
||||
this._isLoading = false;
|
||||
this.notifyHandlers();
|
||||
}
|
||||
|
||||
notifyHandlers() {
|
||||
this.handlers.forEach((fn) => fn(this._isLoading));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user