Skip to content

Commit

Permalink
Rollback to redux-form 6.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Mar 5, 2018
1 parent 0404287 commit b5f0c45
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/components/FormUtils/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const renderInput = ({ input, label, placeholder, type, className, meta }

export const renderField = (params) => {
const { icon, meta: { touched, error } } = params

return (
<p className={`control ${icon ? 'has-icon' : ''}`}>
{renderInput(params)}
Expand Down Expand Up @@ -113,12 +114,12 @@ export const validateLengthI18n = (t, errors, fieldName, value, range) => {

export const validateFieldLength = (t, value, range) => {
if (checkLength(value, range))
return false
return undefined
if (!value || value.length < range[0])
return t('main:misc.fieldMinLength', {min: range[0]})
else if (range[1] !== -1 && value.length > range[1])
return t('main:misc.fieldMaxLength', {max: range[1]})
return false
return undefined
}

export const cleanStr = (str) =>
Expand Down
6 changes: 3 additions & 3 deletions app/components/Statements/StatementForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ export class StatementForm extends React.PureComponent {
</header>
<div className="card-content">
<h3 className="statement-text">
<Field autoFocus component={renderTextareaField} name="text"
autosize={true} normalize={cleanStrMultiline}
<Field name="text" component={renderTextareaField}
normalize={cleanStrMultiline}
maxLength={STATEMENT_LENGTH[1]}
validate={value => validateFieldLength(t, value, STATEMENT_LENGTH)}
placeholder={speaker ? t('statement.textPlaceholder') : t('statement.noSpeakerTextPlaceholder')}
hideErrorIfEmpty
hideErrorIfEmpty autoFocus autosize
/>
</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react-select": "^1.2.1",
"redux": "^3.6.0",
"redux-actions": "^2.2.1",
"redux-form": "^7.3.0",
"redux-form": "6.8.0",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.2.0",
"reselect": "^3.0.1",
Expand Down

0 comments on commit b5f0c45

Please sign in to comment.