Reactjs 无法在自动完成材质UI中读取null的属性“selectionEnd”

Reactjs 无法在自动完成材质UI中读取null的属性“selectionEnd”,reactjs,autocomplete,material-ui,Reactjs,Autocomplete,Material Ui,我对自动完成有问题 react文本掩码如下所示: <MaskedInput {...other} ref={ref => { inputRef(ref ? ref.inputElement : null); return ref; }} mask={[ /\d/, /\d/, /\d/, /\d/, ' ', /\d/, /\d/, /\d/, ' ', /\d/,

我对自动完成有问题 react文本掩码如下所示:

<MaskedInput
  {...other}
  ref={ref => {
    inputRef(ref ? ref.inputElement : null);
    return ref;
  }}
  mask={[
    /\d/,
    /\d/,
    /\d/,
    /\d/,
    ' ',
    /\d/,
    /\d/,
    /\d/,
    ' ',
    /\d/,
    /\d/,
    /\d/,
    /\d/,
  ]}
  placeholderChar={'\u2000'}
/>;
自动完成组件如下所示:

<AmountAutoComplete
  options={this.state.autoCompleteOptions.map(option => option.title)}
  renderInput={params => {
    return (
      <TextField
        value={this.props.value}
        onChange={e => {
          onValueChange(e.currentTarget.value, '');
        }}
        InputProps={{
          inputComponent: this.TextMaskCustom,
        }}
      />
    );
  }}
/>;
<TextField
    {...params}
     InputProps={{
     ...params.InputProps,
    }} 
 />
错误是

无法读取null的属性“selectionEnd” 在handleClick中使用autocomplete.js:763

并且在useAutocomplete.js:763中有关于inputRef的错误:

var handleClick=函数handleClick{ 如果firstFocus.current&&inputRef.current.selectionEnd-inputRef.current.selectionStart==0{ inputRef.current.focus; inputRef.current.select;
}

我应该像这样将参数发送到文本字段:

<AmountAutoComplete
  options={this.state.autoCompleteOptions.map(option => option.title)}
  renderInput={params => {
    return (
      <TextField
        value={this.props.value}
        onChange={e => {
          onValueChange(e.currentTarget.value, '');
        }}
        InputProps={{
          inputComponent: this.TextMaskCustom,
        }}
      />
    );
  }}
/>;
<TextField
    {...params}
     InputProps={{
     ...params.InputProps,
    }} 
 />

你在使用之前创建了ref吗?你能给我们看一下代码吗?我使用的是你提供的URL中的材质UI文档ref的确切模式,它来自于道具,同样,你以前创建过你的ref吗?你能给我们看一下你创建它的代码块吗?我只是在MaskInput类文档中使用ref,我不使用It classjavascript TextMaskCustom=props=>{const{inputRef,…other}=props;返回{inputRef?ref.inputeElement:null;}}}mask={[/\d/,/\d/,/\d/,/\d/,'',/\d/,/\d/,'',/\d/,'}占位符字符={'\u2000'}/>;};