3
<InputAutoSuggest
    name="name"
    suggestions={this.props.theatreSuggestions}
    onSuggestionsFetchRequested={this.props.onSuggestionsFetchRequested}
    onSuggestionsClearRequested={this.props.onSuggestionsClearRequested}
    getSuggestionValue={this.getSuggestionValue}
    renderSuggestion={this.renderSuggestion}
    inputPropsValue={this.props.newVal}
    value={this.props.value}
    onChange={setFieldValue}
    onBlur={setFieldTouched}
    error={errors.name}
    touched={touched.name} 
    onSuggestionSelected={this.onSuggestionSelected}
    newChange={this.props.newChange}
/>
{ errors.name && touched.name && <div className="invalid-feedbac">{errors.name}</div>}

所以从这里开始,它进入自动建议输入操作,但是每当我输入一些错误时,都会继续显示。表单也不会被提交

编辑(来自评论)

错误描述:

validationSchema={ Yup.object().shape({ name: Yup.string() .required("Theatre name is required!"), street1: Yup.string() .required("Street1 name is required!"), 

所以这是我的架构,每当我输入名称时,它都会显示验证消息,剧院名称是必需的。

4

0 回答 0