mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-15 04:35:57 +05:30
#106: recalculate form height, after lang changed
This commit is contained in:
parent
61534b069b
commit
0816e7a848
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ class ChangeEmailPage extends Component {
|
||||
|
||||
static propTypes = {
|
||||
email: PropTypes.string.isRequired,
|
||||
lang: PropTypes.string.isRequired,
|
||||
params: PropTypes.shape({
|
||||
step: PropTypes.oneOf(['step1', 'step2', 'step3']),
|
||||
code: PropTypes.string
|
||||
@ -40,6 +41,7 @@ class ChangeEmailPage extends Component {
|
||||
<ChangeEmail
|
||||
onSubmit={this.onSubmit}
|
||||
email={this.props.email}
|
||||
lang={this.props.lang}
|
||||
step={step.slice(-1) * 1 - 1}
|
||||
onChangeStep={this.onChangeStep}
|
||||
code={code}
|
||||
@ -98,6 +100,7 @@ function handleErrors(repeatUrl) {
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
export default connect((state) => ({
|
||||
email: state.user.email
|
||||
email: state.user.email,
|
||||
lang: state.user.lang
|
||||
}), {
|
||||
})(ChangeEmailPage);
|
||||
|
Loading…
Reference in New Issue
Block a user