Material-UI:为createMuiTheme提供的阴影数组应支持25个高程 [英] Material-UI: the shadows array provided to createMuiTheme should support 25 elevations

查看:76
本文介绍了Material-UI:为createMuiTheme提供的阴影数组应支持25个高程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试消除Material-UI主题中的阴影.

I'm trying to get rid of shadows in the Material-UI theme.

我在此处找到了答案并已解决.但是,我在此问题的标题中收到错误消息.

I found this answer here with fixed the problem. However I get the error message in the title of this question.

const theme = createMuiTheme({
  palette: {
    primary: {
      light: red[300],
      main: red[500],
      dark: red[700]
    },
    secondary: {
      light: red.A200,
      main: red.A400,
      dark: red.A700
    }
  },
  shadows: ['none']
});

错误:

browser.js:49警告:Material-UI:为createMuiTheme提供的阴影阵列应支持25个高程.

browser.js:49 Warning: Material-UI: the shadows array provided to createMuiTheme should support 25 elevations.

我找到了这个解决方案,但是答案没有帮助: https://github.com/mui-org/material-ui/issues/8289

I found this solution, but the answer was not helpful: https://github.com/mui-org/material-ui/issues/8289

推荐答案

看起来它希望您的主题至少具有25个阴影,以便创建在Material UI中看到的进度.虽然我当然不建议您尝试遵循Material UI标准来消除阴影,但是一种简单的方法可能是将所有高程级别都设置为none.

It looks like it expects your Theme to have at least 25 shadows, in order to create the progression seen in Material UI. While I certainly don't recommend removing the shadows if you're trying to follow Material UI standards, one easy way to do it might just be to set all levels of elevation to none.

const theme = createMuiTheme({
  palette: {
    primary: {
      light: red[300],
      main: red[500],
      dark: red[700]
    },
    secondary: {
      light: red.A200,
      main: red.A400,
      dark: red.A700
    }
  },
  shadows: Array(25).fill('none')
});

这应该满足要求.

这篇关于Material-UI:为createMuiTheme提供的阴影数组应支持25个高程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆