Material-ui: react-event-listener incompatibility >=0.5.6

Created on 23 May 2018  路  7Comments  路  Source: mui-org/material-ui

  • [x] This is a v1.x issue (v0.x is no longer maintained).
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

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>

Current Behavior

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

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | v1.0.0 |
| React | v16.3.2 |
| browser | Chrome 66 |

bug 馃悰

All 7 comments

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",

  • "module": "dist/react-event-listener.esm.js",
    "scripts": {
    ``

@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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbozan picture rbozan  路  3Comments

chris-hinds picture chris-hinds  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

revskill10 picture revskill10  路  3Comments

ghost picture ghost  路  3Comments