我有一个自定义模式,其中我有2个反应选择组件。模态体已经准备好在内容超出其大小的情况下自动滚动,但是反应选择组件下拉打开模态中的这个溢出,这是我不想要的。没有溢出,它工作正常。
我正在使用CSS模块。
<div className={styles.modalBody}>
{this.props.children}
</div>
.modalBody {
padding: padding;
flex: 1 1 auto;
height: 45vh;
max-height: 100%;
overflow: auto;
}
<Select
id={this.props.id}
className={styles[this.props.selectType ? this.props.selectType : 'selectWhite']}
classNamePrefix="select"
name={this.props.name}
value={selectedOption ? selectedOption : this.props.value}
placeholder={this.props.placeholder}
onChange={this.onChange}
options={this.props.options}
isDisabled={this.props.disabled}
isSearchable={false}/>
我怎样才能解决这个问题?谢谢! :)
你想看看menuPortalTarget
道具。有一个topic on this in the Advanced documentation,特别是提供了一个模态示例。就像是:
<Select
{...otherProps}
menuPortalTarget={document.body} />