diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 2eb118b87..891db0710 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -1,5 +1,6 @@ import React, { Component } from 'react' import { Trans } from 'react-i18next' +import PropTypes from 'prop-types' import classNames from 'classnames' import { connect } from 'react-redux' import { Field, change, formValueSelector } from 'redux-form' @@ -32,6 +33,9 @@ export var FormDecorator = formType => RenderField => }) ) class extends Component { + static contextTypes = { + i18n: PropTypes.object.isRequired + } state = { helpVisible: false } @@ -69,7 +73,8 @@ export var FormDecorator = formType => RenderField => inversion, inverted, themeColours - } = this.props + } = this.props, + { i18n } = this.context /* Nos propriétés personnalisées à envoyer au RenderField. Elles sont regroupées dans un objet précis pour pouvoir être enlevées des @@ -89,7 +94,8 @@ export var FormDecorator = formType => RenderField => let wideQuestion = formType == 'rhetorical-question' && !possibleChoice let { pre = v => v, test, error } = valueType ? valueType.validator : {}, - validate = test && (v => (v && test(pre(v)) ? undefined : error)) + validate = test && (v => (v && test(pre(v)) ? undefined : error)), + inversionQ = path(['props', 'step', 'inversion', 'question'])(this) let question = (