Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: undefined is not an object (evaluating 'color.charAt') #8960

Closed
1 task done
mario-zancanaro opened this issue Nov 2, 2017 · 1 comment
Closed
1 task done
Labels
support: question Community support but can be turned into an improvement

Comments

@mario-zancanaro
Copy link

Hello!
I cloned the project fount at: https://github.com/callemall/material-ui/tree/v1-beta/examples/create-react-app as docs suggest and I also had an error as mentioned in: #4664

Apart this, I tried to change colors to customize them and I had:
TypeError: undefined is not an object (evaluating 'color.charAt')
captura de tela 2017-11-02 as 13 09 24

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Have the colors set correctly

Current Behavior

An error pop-ups with: TypeError: undefined is not an object (evaluating 'color.charAt')

Steps to Reproduce (for bugs)

Please, check out the cloned code from you at: https://codesandbox.io/s/rr25l6v7rq

In styles/createContext.js line 9 the color is printed correctly.
However, when placed in the configuration like at line 12 the error happens.
Changing the line 12 from purple[500] to purple everything works fine.

@oliviertassinari oliviertassinari added the support: question Community support but can be turned into an improvement label Nov 2, 2017
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 2, 2017

This is a fragment extracted from your demo:

const theme = createMuiTheme({
  palette: {
    primary: purple[500], //DO NOT WORK
    //primary: purple, //WORKS FINE
    secondary: green,
  },
});

It's the expected behavior. You mush have a warning in the console explaining more what's going on. You can learn more about our wordings in the documentation. You are providing a hue of a color, not a palette. We often assimilate a color to be a palette.

The situation will improve with #8075.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

2 participants