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

Error with using ToggleStar (and other child elements from examples like: ActionGrade) #1309

Closed
TrySpace opened this issue Aug 1, 2015 · 7 comments
Labels
bug 🐛 Something doesn't work docs Improvements or additions to the documentation

Comments

@TrySpace
Copy link
Contributor

TrySpace commented Aug 1, 2015

When using from the example:

  <FloatingActionButton>
    <ToggleStar />
  </FloatingActionButton>

Gives:

  • Warning: React.createElement: type should not be null or undefined. It should be a string (for DOM elements) or a ReactClass (for composite components).
  • Warning: Only functions or strings can be mounted as React components.
  • Uncaught TypeError: Cannot read property 'toUpperCase' of undefined (ReactDefaultInjection.js:54 )

Or:

   <IconButton tooltip="Star" touch={true}>
      <ActionGrade/>
   </IconButton>

Gives the same error

@oliviertassinari
Copy link
Member

Have you imported the ToggleStar and FloatingActionButton component?

@TrySpace
Copy link
Contributor Author

TrySpace commented Aug 5, 2015

@oliviertassinari Yes, definitely

I think it would be best reproducible by requiring material-ui and react in a fresh project, as opposed to working in this repo directly.

@hai-cea
Copy link
Member

hai-cea commented Aug 6, 2015

@TrySpace Please make sure your require is:

const ActionGrade = require('material-ui/lib/svg-icons/action/grade');

@TrySpace
Copy link
Contributor Author

TrySpace commented Aug 7, 2015

I will try this later, but note that this is nowhere in the documentation: http://material-ui.com/#/components/buttons ( I assume it is in the demo-code somewhere, but that's a 63000 line source-file ;) and I wouldn't know where else to extrapolate the information you just gave me )

I've encountered other cases where Importing MenuItem gave the same problem, where one needed the mui.MenuItem, and the other MenuItem = require('material-ui/lib/menus/menu-item') ( I ended up making two seperate modules, although renaming the MenuItem would've sufficed, but is just confusing )

How will this change and be unified in future releases?

@alitaheri alitaheri added the bug 🐛 Something doesn't work label Dec 8, 2015
@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Jan 4, 2016
@oliviertassinari
Copy link
Member

That's an issue with the documentation. We can close it as soons as #2433 is closed.

@mbrookes
Copy link
Member

#2433 is closed. 👍

@alitaheri
Copy link
Member

🎉 🎈

mnajdova pushed a commit to mnajdova/material-ui that referenced this issue Nov 10, 2020
* Documentation improvements  (mui#1229)

* [docs] Show DateIOType instead of anys  (mui#1228)

* Show DateIOType instead of any in prop types tables

* Update patrons list

* Remove unused filter

* Ovveride keyboard datepicker onChange date type

* Update prop-types.json

* Clarify TypeScript instructions for CSS overrides (mui#1257)

* Fix MuiPickersOverrides import in CSS guide

* Make instructions a little more dummy proof

* Tidyup build config (mui#1309)

* Tidyup build config

- upgraded babel
- upgraded rollup
- fixed material-ui globals
- replaced babel cli with rollup config with many entries
- auto resolve named exports
- skip non existent export warning
- import correct (esm/cjs) babel helpers
- error when material-ui global is not provided

Here's generated build/esm/. Treeshaking should work fine.

```
Calendar-b9ae6101.js
Calendar.js
Clock-3486e4fb.js
Clock.js
ClockView.js
DatePicker.js
DateTimePicker.js
Day.js
Picker-429246aa.js
Picker.js
TimePicker.js
TimePickerToolbar-e568e280.js
Wrapper-12538b96.js
index.js
makePickerWithState-8a1dec7e.js
useUtils-7fbeb79a.js
```

* Remove object-rest-spread
mnajdova pushed a commit to mnajdova/material-ui that referenced this issue Nov 10, 2020
* Update packages

* [typescript] Fix extending TextField issue

* Master (mui#1314)

* Documentation improvements  (mui#1229)

* [docs] Show DateIOType instead of anys  (mui#1228)

* Show DateIOType instead of any in prop types tables

* Update patrons list

* Remove unused filter

* Ovveride keyboard datepicker onChange date type

* Update prop-types.json

* Clarify TypeScript instructions for CSS overrides (mui#1257)

* Fix MuiPickersOverrides import in CSS guide

* Make instructions a little more dummy proof

* Tidyup build config (mui#1309)

* Tidyup build config

- upgraded babel
- upgraded rollup
- fixed material-ui globals
- replaced babel cli with rollup config with many entries
- auto resolve named exports
- skip non existent export warning
- import correct (esm/cjs) babel helpers
- error when material-ui global is not provided

Here's generated build/esm/. Treeshaking should work fine.

```
Calendar-b9ae6101.js
Calendar.js
Clock-3486e4fb.js
Clock.js
ClockView.js
DatePicker.js
DateTimePicker.js
Day.js
Picker-429246aa.js
Picker.js
TimePicker.js
TimePickerToolbar-e568e280.js
Wrapper-12538b96.js
index.js
makePickerWithState-8a1dec7e.js
useUtils-7fbeb79a.js
```

* Remove object-rest-spread

* Update packages

* Fix typescript compilation errros
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests

5 participants