我在自动完成方面遇到了一些问题。
我的 API 返回了大量数据,当我在自动完成搜索栏中输入单词时,下拉菜单会隐藏文本输入。
我尝试覆盖样式:
<AutoComplete
hintText="For example, Coca-Cola"
floatingLabelText="Search entities"
onUpdateInput={this.updateInput}
dataSource={autoCompleteDataSource}
filter={this.caseInsensitiveFilter}
menuStyle={styles}
ref="searchBox" />
var styles = {
top: '53%'
};
但这根本不起作用(也许我试图以错误的方式覆盖它?)。
有人对此有想法吗?
非常感谢!
最佳答案
使用anchorOrigin,它是自动完成的 anchor 的位置。它有一个默认值 {vertical: 'bottom',horizontal: 'left' }。
关于ReactJS Material-UI 如何设置始终覆盖文本字段的自动完成样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37173028/