mui / material-ui

Material UI: Ready-to-use foundational React components, free forever. It includes Material UI, which implements Google's Material Design.

Home Page:https://mui.com/material-ui/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onTouchTap doesn't seem to work with WebPack and ReactJS 14.0x

JasonWeise opened this issue · comments

onTouchTap doesn't seem to work with WebPack.
For example with IconMenu I cannot get the menu to open when using WebPack and it appears to be because react-tap-event-plugin is not being initialised.
I have included react-tap-event-plugin in node_modules and there are no console errors in browser, just doesn't seem to work at all. The IconMenu itself renders ok and graphically reacts to the click in browser but no MenuItems show at all :(

I am using ReactJS 14.0 with WebPack and none of the components seem to respond if using onTouchTap, I have had to use onClick, but with IconMenu I can't seem to do this... HELP!

Thanks in advance guys :)

If none of that made sense, just let me know and I will try to clarify.

Just to be sure... did you call injectTapEventPlugin(); ?

Not sure why this was closed?
Yes I am calling injectTapEventPlugin(); and it doesn't work.

It doesn't work on the simplest of components.

Can you post your code? Is it on github somewhere?

Hey - I stumbled upon the same issue, and it seems this might happen when loading React as a webpack external, as this issue might suggest. In my case, I'm using the webpack Meteor project bootstrap which loads React externally from a meteor package.

My solution was to add another Meteor package, coniel:react-tap-event-plugin and add it as a webpack external. Then calling injectTapEventPlugin() from my app patches the right React version (and not the one loaded as a dependency by other packages in node_modules).

@dbismut .... great find! that fixed it for me as well.... I was ripping my hair out and started modifying to just use onClick... thanks so much for the tip!