web-dev-qa-db-ja.com

エラーTypeError:color.charAtはC:/...../ node_modules/@material-ui/core/styles/colorManipulator.js:148の関数ではありません

エラーのスクリーンショットへのリンクは次のとおりです。 https://drive.google.com/open?id=1HL-Fy1M4tHp9qMUpt88PzOfI10AHHem-

これは、色が使用されるコード部分です。

const theme = createMuiTheme({
  palette: {
    primary: {
      light: '#33c9dc',
      main: '#00bcd4',
      dark: '#008394',
      contrastText: '#fff'
    },
    secondary: {
      light: '#ff6333',
      main: '#ff3d00',
      dark: '#b22a00',
      contrastText: '#fff'
    }
  },
  typography: {
    useNextVariants: true
  },
  form: {
    textAlign: "center"
  },
  image: {
    margin: "10px auto 10px auto"
  },
  pageTitle: {
    margin: "10px auto 10px auto"
  },
  textField: {
    margin: "10px auto 10px auto"
  },
  button: {
    marginTop: 20,
    position: "relative"
  },
  customError: {
    color: "red",
    fontSize: "0.8rem",
    marginTop: 5
  },
  progress: {
    position: "absolute"
  }
});

私はすでに16進数からRGB値に色を変更しようとしましたが、うまくいきませんでした。

13
Pulkit Garg

私の場合、パレットに空のオブジェクトがありました:

export default {
  breakpoints: {...},
  text: {
    primary: "rgba(0, 0, 0, 0.87)",
    secondary: "rgba(0, 0, 0, 0.54)",
    disabled: "rgba(0, 0, 0, 0.38)",
    hint: "rgba(0, 0, 0, 0.38)"},
  divider: {}, // This was the issue, Either remove or put values in
  background: {
    paper: "#fff",
    default: "#fafafa",
    test: "#616161"
  },
};

コア、スタイル、アイコンのライブラリには何の影響もありませんでしたが、何年もの間、あなたと同じエラーが発生していました。これを削除すると、問題が解決しました。

1
Christan Foden