Install @material-ui/core 1.0.0 from npm it pulls in react-event-listener 0.5.8 as per dependency of ^0.5.1.
Create a tooltip as so, tooltip should render...
<Tooltip title="title">
<span>Content</span>
</Tooltip>
Throws an error.
Warning: React.createElement: type is invalid -- expected a string (for built-in component) or a class/function (for composite components) but got: object.
Check the render method of `Tooltip`.
...
A little more digging reveals that the import of react-event-listener comes back with a nested default
{
default: {
default: function () { ... }
}
}
Forcing an install of react-event-listener 0.5.5 doesn't display this issue. The import comes in as expected
| Tech | Version |
|--------------|---------|
| Material-UI | v1.0.0 |
| React | v16.3.2 |
| browser | Chrome 66 |
Please provide a full reproduction test case. This would help a lot 馃懛 .
A live example would be perfect. This codesandbox.io template _may_ be a good starting point. Thank you!
It's working fine in https://codesandbox.io/s/5v5nl0x56k.
I can't seem to get it working on codesandbox. Here's a git repo. Hope that helps!
git clone https://github.com/Thomas101/material-ui-examples.git
cd material-ui-examples/11550-react-event-listener
npm install
npm start
open index.html
@TrySound Any idea?
The following diff solves the problem:
```diff
{
"name": "react-event-listener",
"version": "0.5.8",
"description": "A React component that allow to bind events on the global scope",
"main": "dist/react-event-listener.cjs.js",
@oliviertassinari The problem is probably happens because of mixing default and named exports. I believe that breaking change with import { EventListener } from 'react-event-listener' will solve the problem. default exports suck again. So let's publish 0.5.9 without esm and then make this breaking change.
Just remove that line for 0.5.9.
Wow that's some stellar fixing :). Confirm fixed. Thanks very much!