zilverline / react-tap-event-plugin

Instant TapEvents for React
http://facebook.github.io/react/
MIT License
1.07k stars 110 forks source link

Loading w/ external React module #28

Closed julieReitter closed 9 years ago

julieReitter commented 9 years ago

We're trying to use this library and Material UI in our app that is built with requirejs. We have a separate "react" module that's being loaded from a compiled version of React 0.13 and therefore we don't have access to the individual React modules that are needed for this patch to work.

One attempt we've made is to use browserify to build a patched version of react-with-addons and then include that in our module dependencies.

React = require("../../node_modules/react/dist/react-with-addons");
React.initializeTouchEvents(true);

injector = require("../../node_modules/react-tap-event-plugin/src/injectTapEventPlugin");
injector();

module.exports = React;

Is there a more straightforward way to accomplish this? Also, this didn't work initially. We had to downgrade to React 13.0 and react-tap-event-plugin 1.6 to get it to work.

zdychacek commented 9 years ago

+1

hartmamt commented 9 years ago

Quick webpack example of how to patch react-with-addons with the tap events plugin. This is required as far as I can tell if you want to use material-ui with react as an external dependency. https://github.com/hartmamt/react-with-tap-events

webuniverseio commented 7 years ago

For anyone who'll come to here looking for solution, link from comment above will not work if you use React 14+ as support for initializeTouchEvents was removed.