简体   繁体   English

Material-UI:WithStyles(ForwardRef(Dialog)) 中未实现提供给 classes 道具的关键 `paperFullWidth`

[英]Material-UI: The key `paperFullWidth` provided to the classes prop is not implemented in WithStyles(ForwardRef(Dialog))

Material-UI: The key paperFullWidth provided to the classes prop is not implemented in WithStyles(ForwardRef(Dialog)). Material-UI:提供给 classes 道具的关键paperFullWidth未在 WithStyles(ForwardRef(Dialog)) 中实现。 You can only override one of the following: root.您只能覆盖以下其中一项:root。

 <Dialog
      classes={{
        paperFullWidth: props.classes.dialogCustomizedWidth,
        paper: props.classes.dialogPaper,
      }}
      transitionDuration={{ enter: 0, exit: 0 }}
      fullWidth={true}
      maxWidth={false}
      aria-labelledby="customized-dialog-title"
     
    ></Dialog>

You can't use withStyles and styles differently from the element to manipulate the dialog element.您不能使用与元素不同的 withStyles 和样式来操作对话框元素。

For example, incorrect usage:例如,不正确的用法:

const styles = (theme) => ({
  dialogPaper: {
    height: "95%",
    padding: 0,
    margin: 0,
  },
  dialogCustomizedWidth: {
    "max-width": "70%",
    "max-heigth": "95%",
  },
  root: {
    margin: 0,
    backgroundColor: theme.palette.dialogCustom.titleBg,
  },
  closeButton: {
    position: "absolute",
    right: theme.spacing(1),
    top: theme.spacing(1),
    color: theme.palette.dialogCustom.titleIconColor,
    padding: 3,
  },
  titleTypography: {
    color: theme.palette.dialogCustom.titleTextColor,
  },
});

const Dialog = withStyles((theme) => ({
  root: {
    margin: 10,
  },
}))(MuiDialog);

function dialog(props) {
  return (
    <Dialog
      classes={{
        paperFullWidth: props.classes.dialogCustomizedWidth,
        paper: props.classes.dialogPaper,
      }}
      transitionDuration={{ enter: 0, exit: 0 }}
      fullWidth={true}
      maxWidth={false}
      aria-labelledby="customized-dialog-title"
      open={props.visible}
      onClose={() => {
        props.close();
      }}
    >
      <DialogTitle
        id="customized-dialog-title"
        onClose={() => {
          props.close();
        }}
      >
        {props.title}
      </DialogTitle>
      <DialogContent
        dividers
        style={{ overflowX: "hidden", margin: 0, padding: 0 }}
      >
        {props.children}
      </DialogContent>
    </Dialog>
  );
}

export default withStyles(styles)(dialog);

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

相关问题 "index.js:1 Material-UI:提供给 classes 属性的键 `selectLabel` 未在 ForwardRef(TablePagination) 中实现" - index.js:1 Material-UI: The key `selectLabel` provided to the classes prop is not implemented in ForwardRef(TablePagination) React Material-UI:提供给classes属性的键未在undefined中实现 - React Material-UI: the key provided to the classes property is not implemented in undefined 在 React with Jest 中为 @material-ui withStyles 创建手动模拟 - Create manual mock for @material-ui withStyles in React with Jest 如何使用 Typescript 实现 Material-UI ThemeProvider 和 WithStyles - How to implement Material-UI ThemeProvider and WithStyles using Typescript 以嵌套方式使用material-ui v1的withStyles - Using withStyles of material-ui v1 in a nested manner 外部文件上的材质-ui withStyles无法正常工作 - React material-ui withStyles on external file not working “ material-ui”不包含名为“ withStyles”的导出 - 'material-ui' does not contain an export named 'withStyles' 使用 styed-components 和 Material-UI withStyles 的 TextField 样式 - TextField Style using styed-components and Material-UI withStyles 使用 forwardRef 和 typescript 扩展 material-ui 组件 - Extend material-ui component using forwardRef and typescript 有条件地使用 material-ui 默认道具 - Conditionally use material-ui default prop
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM