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

Uncaught Error: Invariant Violation: EventPluginRegistry: Cannot inject two different event plugins using the same name, TapEventPlugin. #47

Open
moroshko opened this issue Oct 20, 2015 · 7 comments

Comments

@moroshko
Copy link

When integrating multiple components that use react-tap-event-plugin (e.g. react-autosuggest) the following error appears:

Uncaught Error: Invariant Violation: EventPluginRegistry: Cannot inject two different event plugins using the same name, TapEventPlugin.

Is there a way to make sure that react-tap-event-plugin is instantiated only once?

@prewk
Copy link

prewk commented Jan 31, 2016

Is there a solution for this? I'm using a material-ui that requires react-tap-event-plugin, but if I try to run injectTapEventPlugin(); I've suddenly started getting this error as well.

@delphinefoo
Copy link

I've found a workaround for this: call injectTapEventPlugin() just once, in componentWillMount() of your top-level app component. This made the tap event plugin available in all of my child components and it was called only once.

@madjam002
Copy link

At the moment injectTapEventPlugin can only be called once.
@delphinefoo I wouldn't recommend putting it in componentWillMount, just put it at the top level of your application, just before you call ReactDOM.render.

@madjam002
Copy link

@prewk material-ui shouldn't be bringing in tap event plugin, you should be calling it in your application and only once. Are you sure another component isn't calling it instead as well?

See
https://github.com/callemall/material-ui#react-tap-event-plugin

@prewk
Copy link

prewk commented Feb 4, 2016

Yeah I wrote about it in another issue pointing here, my problem was a strange edge case with the require-new library so never mind me.

@linonetwo
Copy link

If using universal rendering, just put it over client.js, everything will be fine.

@romainPellerin
Copy link

To fix this issue only call one time var tapEventPlugin = require("react-tap-event-plugin")(); in your app or lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants