diff --git a/source/components/conversation/Input.js b/source/components/conversation/Input.js index f93ae0de9..e2caf023e 100644 --- a/source/components/conversation/Input.js +++ b/source/components/conversation/Input.js @@ -1,5 +1,5 @@ -import React, {Component} from 'react' -import {FormDecorator} from './FormDecorator' +import React, { Component } from 'react' +import { FormDecorator } from './FormDecorator' import classnames from 'classnames' import R from 'ramda' @@ -10,44 +10,57 @@ export default class Input extends Component { } render() { let { - name, - input, - stepProps: {attributes, submit, valueType, suggestions}, - meta: { - touched, error, active, - }, - themeColours, - } = this.props, + name, + input, + stepProps: { attributes, submit, valueType, suggestions }, + meta: { touched, error, active }, + themeColours + } = this.props, answerSuffix = valueType.suffix, suffixed = answerSuffix != null, inputError = touched && error, - sendButtonDisabled = this.state.suggestedInput || !input.value || inputError + sendButtonDisabled = + this.state.suggestedInput || !input.value || inputError - if (typeof suggestions == 'string') - return return ( - key == 'Enter' && input.value && ( - !error ? - submit() : - input.onBlur() // blur will trigger the error - )} - /> - { suffixed && - ) } - renderSuggestions(themeColours){ - let {setFormValue, submit, suggestions} = this.props.stepProps + renderSuggestions(themeColours) { + let { setFormValue, submit, suggestions } = this.props.stepProps if (!suggestions) return null return ( - suggestions: - - ) + + suggestions: + + + ) } }