virtru / virtuoso-design-system

Virtuoso Design System curated by @virtru UX & engineering
https://virtru.github.io/virtuoso-design-system/
MIT License
5 stars 19 forks source link

ToggleButton does not work #134

Open cody-lettau opened 3 years ago

cody-lettau commented 3 years ago

🐞 bug report

The ToggleButton component throws an error when being rendered:

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

Description

When using the ToggleButton component, an error is thrown when rendering it (see error above). The issue appears to possibly be related to how the react-toggle import is defined. See http://aaronshaf.github.io/react-toggle/ for details regarding how it should be imported (specifically, the name of the import should be Toggle instead of ReactToggle it appears).

🔬 Steps to Reproduce

Simply using the ToggleButton component leads to this error being thrown when rendered. I tested straight use of react-toggle and it works as expected when I import the library following their guidance in the documentation linked above.

🔥 Exception or Error


React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

🌍 Your Environment

Version:


"react": "^16.14.0",
"react-dom": "^16.14.0",

Anything else relevant?

avkvirtru commented 3 years ago

Pending larger discussion about using an existing React component library as the underpinnings of the Virtuoso Design System.

avkvirtru commented 3 years ago

FYI @kuguarpwnz worked on the original Toggle component in virtru/react-components https://github.com/virtru/react-components/commits/master/lib/components/ToggleButton

We can revisit this when we've decided on the React component library.

kuguarpwnz commented 3 years ago

Still works well when I import it from react-components. Should be easily fixed by changing the way it's imported. Please see https://github.com/aaronshaf/react-toggle/issues/97