Необходимо добавить поле на основе значения свойства для метки ввода - PullRequest
0 голосов
/ 10 мая 2019

Я использую 'response-material-ui-form-validator' в моей форме. У меня есть компонент выбора, который отображает значения, переданные от родителя.

<FormControl required={this.props.required} variant="filled" className={classes.formControl}>
        <SelectValidator
          validators={this.props.required ? ['required'] : ''}
          errorMessages={this.props.required ? ['This field is required']: ''}

          value={this.state.value}
          onChange={this.handleChange}
          input={<FilledInput 
          required={this.props.required} 
          classes={ MuiFormLabel style={ color: option.color, marginLeft: selectWithIcon ? "30px" : ""}}
          id={this.props.id} />}
        >
        {this.props.options && this.props.options.map(option => ( 
          <MenuItem key={option.key} value={option.value} >
            {option.icon}{<ListItemText className={classes.listItemText} primary={<Typography style={{ color: option.color, marginLeft: selectWithIcon ? "30px" : ""}}>{option.text}</Typography>}/>}
          </MenuItem>
        ))}
        </SelectValidator>
      </FormControl>

Я смог добавить дополнительные поля в поле ввода, используя условие

marginLeft: selectWithIcon ? "30px" : ""}}

Но я не могу добавить интервал в поле метки.

...