-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Can't use <Avatar /> component #984
Comments
@hackingbeauty FileFolder is not exported https://github.com/callemall/material-ui/blob/master/src/index.js. Currently, if you want to get at any of the svg-icons you'll need to get at them from node_modules/material-ui/lib/svg-icons. @hai-cea Any thoughts on exporting the svg-icons (as part of src/index.js or src/svg-icons/index.js)? Or is the icon-builder what @hackingbeauty should be using? |
I would suggest you not to use the index. With this library, it's simpler, but you end up loading a lot of components that you don't use. |
@oliviertassinari The index would be at src/svg-icons/index.js and not src/index.js. This way we do not bloat the index at src/index.js. |
Yeh, I agree that we shouldn't add it to index.js. I don't see any harm in adding index.js to the icon folder and subfolders though. It's best to modify the build script to do this. |
I still can't get the Avatar component to work. Whenever I try to render it, I get the following error: "Cannot read property 'toUpperCase' of undefined". Here is my code: import { Avatar } from 'material-ui';
export default React.createClass({
getDefaultProps() {
return {
};
},
render() {
return (
<div>
<Avatar />
</div>
);
}
}); feeling frustrated Why isn't this working? |
@jkruder Yes, that's fine. What I was saying is not directly linked to this issue. |
@hackingbeauty Doesn't look like you've specified a src attribute or any children? |
Even when specifying an src attribute, the component does not work. Not sure what you're referring to by "children". I'm disappointed I can't use this component. |
I'm not sure what difference there is between your code base and the docs site. Here are the different variations of the Avatar component: |
Thanks for the reference @hai-cea. Still doesn't work. The error originates on line 36761 of index.js (autoGenerateWrapperClass function). For some reason, when I try to use the Avatar component, the type argument sent to autoGenerateWrapperClass is undefined. |
@hackingbeauty I've seen this error when the thing being rendered is undefined. I was working with someone on the table components a few days ago and the table-row had not been exported but they had put import { TableRow } from 'material-ui'
...
render() {
return <TableRow .../>
}
... So, I'm thinking Avatar is not available for you to render. It's currently exported in the index and you're not seeing any errors about not finding material-ui. So, I think you're using a version that does not have the Avatar component. Can you check node_modules/material-ui/lib/ for avatar.js? |
Hey @jkruder, I checked inside of node_modules/material-ui/lib and avatar.js is NOT there. All the other components are there. The version of material-ui I have installed is 0.8.0. I tried to uninstall and reinstall, but I still get v0.8.0. Am I using an incorrect version? |
I would try 'npm cache clear' to clear your local cache and then try installing. If that doesn't work I would try 'npm install material-ui@0.9.2' to grab the latest. |
@jkruder, that was it! Why isn't 0.9.2 automatically installed when someone runs "npm install material-ui"? |
@hackingbeauty It could be a couple things. The most likely reason is you have a cached version of MUI that meets the version requirements in your package.json or you're not using the public NPM registry. I would check your version requirement in your package.json first. |
@hackingbeauty Is there anything else that we can help you with in regards to this issue? |
@jkruder, I'm ok for now, thanks! |
Today, we also have an |
* Remove typing for deprecated openToYearSelection * [mui#984] Fix not working onlyCalendar prop * Change onlyCalendar prop description
Hello!
Am I using the Avatar component correctly? I'm trying to display the file folder icon and it's not working.
The text was updated successfully, but these errors were encountered: