mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
gender step gets custom input ref, focuses on click
This commit is contained in:
parent
5ec8811427
commit
2aa5ea0f02
1 changed files with 9 additions and 1 deletions
|
@ -55,9 +55,13 @@ class GenderStep extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
bindAll(this, [
|
bindAll(this, [
|
||||||
|
'handleSetCustomRef',
|
||||||
'handleValidSubmit'
|
'handleValidSubmit'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
handleSetCustomRef (customInputRef) {
|
||||||
|
this.customInput = customInputRef;
|
||||||
|
}
|
||||||
handleValidSubmit (formData, formikBag) {
|
handleValidSubmit (formData, formikBag) {
|
||||||
formikBag.setSubmitting(false);
|
formikBag.setSubmitting(false);
|
||||||
if (!formData.gender || formData.gender === 'null') {
|
if (!formData.gender || formData.gender === 'null') {
|
||||||
|
@ -122,7 +126,10 @@ class GenderStep extends React.Component {
|
||||||
{'gender-radio-row-selected': (values.gender === values.custom)}
|
{'gender-radio-row-selected': (values.gender === values.custom)}
|
||||||
)}
|
)}
|
||||||
/* eslint-disable react/jsx-no-bind */
|
/* eslint-disable react/jsx-no-bind */
|
||||||
onClick={() => setFieldValue('gender', values.custom, false)}
|
onClick={() => {
|
||||||
|
setFieldValue('gender', values.custom, false);
|
||||||
|
if (this.customInput) this.customInput.focus();
|
||||||
|
}}
|
||||||
/* eslint-enable react/jsx-no-bind */
|
/* eslint-enable react/jsx-no-bind */
|
||||||
>
|
>
|
||||||
<FormikRadioButton
|
<FormikRadioButton
|
||||||
|
@ -139,6 +146,7 @@ class GenderStep extends React.Component {
|
||||||
gender: newCustomVal,
|
gender: newCustomVal,
|
||||||
custom: newCustomVal
|
custom: newCustomVal
|
||||||
})}
|
})}
|
||||||
|
onSetCustomRef={this.handleSetCustomRef}
|
||||||
/* eslint-enable react/jsx-no-bind */
|
/* eslint-enable react/jsx-no-bind */
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue