react-select不会自动滚动到所选选项

时间:2019-10-23 15:50:04

标签: reactjs react-select

如何使用react-select滚动到选定的选项?

<Select
              matchProp='label'
              classes={classes}
              inputId="react-select-single"
              TextFieldProps={{
                InputLabelProps: {
                  htmlFor: 'react-select-single',
                  shrink: true,
                },
                disableUnderline: true
              }}
              options={options}
              components={components}
              value={single}
              onChange={handleChangeSingle}
            />

1 个答案:

答案 0 :(得分:1)

您可以使用 react-select 属性,

      menuShouldScrollIntoView={true}

谢谢。