修复 react-select 下拉列表的高度 (React Material UI)

Fix the height of react-select dropdown list (React Material UI)

我已经使用 react-select 实现了下拉列表,使用它会显示预输入选项,但最初下拉列表很大并且占据了整个页面。 我想知道如何将 react-select 下拉列表设置为固定高度并在溢出时提供滚动。 react-select

以下是我的部分代码

class Project extends React.Component {
  render() {
    const selectStyles = {
      input: base => ({
        ...base,
        color: theme.palette.text.primary,
        '& input': {
          font: 'inherit',
        },
      })
    };
    return ( <
      SelectN inputProps = {
        {
          name: 'headedByUserId',
          id: 'headedByUserId',
        }
      }
      classes = {
        classes
      }
      styles = {
        selectStyles
      }
      options = {
        suggestions
      }
      components = {
        components
      }
      value = {
        this.state.fields["headedByUserId"]
      }
      onChange = {
        this.handleChangeDropdown.bind(this, "headedByUserId")
      }
      placeholder = "select owner"

      /
      >
    )
  }
}

react-select 有一个属性

maxMenuHeight="200"

使用这个我们可以设置下拉列表的高度,如果下拉列表在 material 对话框中,您可以将对话框 属性 "overflow":"visible" 设置为被展示