简体   繁体   English

React-如何在“选择材质” UI中自定义下拉菜单

[英]React - How to customize drop downmenu in Select Material UI

I face an issue with Select Component from Material UI, the issue it renders in a diferent way in chrome on windows rather than mac. 我遇到了从Material UI中选择组件的问题,该问题以不同的方式在Windows而不是Mac上以chrome呈现。

on mac, it works just fine but in windows see image attached 在Mac上,效果很好,但在Windows中看到附加的图片

note if I remove native flag it will be working but I like how its renderer as native select 请注意,如果我删除native标记,它将正常工作,但是我喜欢其渲染器作为本机选择的方式

在此处输入图片说明

here is sample on codeSandbox 这是codeSandbox上的示例

https://codesandbox.io/s/yvq524yv8z https://codesandbox.io/s/yvq524yv8z

here is the code sample 这是代码示例

const styles = theme => ({
  dropdownStyle: {
    backgroundColor: "lightgray" --> this change I need to make 
  }
});


<Select
          native
          value={value}
          onChange={this.handleChange("value")}
          name="value"
          variant="filled"
          classes={{
            root: classes.selectEmpty,
            select: classes.select
          }}
          MenuProps={{ classes: { paper: classes.dropdownStyle } }}
        >
          {contracts.map((contractItem, index) => {
            return (
              <option key={contractItem.agent_id} value={index}>
                {contractItem.carrier}
              </option>
            );
          })}
        </Select>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM