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
Problems arise when using meteor add react
with a browserified React package like material ui
#11
Comments
I have the same issue. Early I tried reactjs:react package with https://github.com/ukabu/material-ui but as a result I got the same issue as mentioned above.Then I have tried https://github.com/mrphu3074/react-material-ui/ and it's works fine, this package exports all components globally. Now with react-packages I do it right and add material-ui via npm and cosmos:browserify but I can't use components because context is undefined. |
The problem involves those packages pulling in their own browserified
|
@stubailo I've seen you removed Could and approch be to install the browserified dependencies via
|
@grigio no, that doesn't help. The problem is that as soon as you install a package that depends on We're going to implement proper NPM/Browserify support soon, but probably not in the next few weeks. |
I mean Material UI works if you install React via cosmos:browserify and the rest a la Meteor way. |
Ah, you're saying you could use the Also, if you load React over NPM, then the There's nothing particularly wrong with |
meteor add react
with a browserified React package like material ui
Yes, you can't choose the React production/development but the rest works pretty well. I wrote a post about it. |
@grigio try this: https://github.com/meteor/react-packages/blob/master/docs/client-npm.md The new version of cosmos:browserify supports transforms, so you can use exposify to use the Meteor React package. |
I tried a few alternative integrations, but I'm not sure I can use Or maybe you mean to load meteor-react, exposify
|
@stubailo I tried to integrate Material UI at app-level
it loaded and present before:
the UI is loaded but it is unusable, it seems
|
I have created a minimal material UI example here: https://github.com/meteor/react-packages/tree/master/examples/material-ui-example Can you help me construct one that fails in the way you describe @grigio? |
@stubailo Your example seems to work, but if I replace
with
and
with:
It doesn't work anymore:
To get the previous error you can replace on your example |
Thanks for the repro! I'll look into it. |
@grigio confirmed, my transform doesn't work in this case because material-ui uses |
This was the result of this issue: thlorenz/exposify#15 As soon as |
Nice, how did you find/debugged that? the errors seems doesn't seem related |
The problem is that material-ui uses So you still end up with duplicates of React. |
@grigio this should work now - check the example: https://github.com/meteor/react-packages/tree/master/examples/material-ui-example You just need to delete your react-packages/examples/material-ui-example/packages/npm-container/.npm/package/npm-shrinkwrap.json Line 21 in 882c86e
|
I have tested this example. The UI is rendered and there are no errors, but actions (clicks) don't work. For example, I can't open DatePicker dialog and etc. |
I guess I don't really know how it's supposed to work - I thought maybe I was using it wrong or something. |
Weird - I just ran the example, and the date picker is actually rendered to the DOM - it just doesn't show up. So I don't think it's actually a problem with Browserify, it's something else. |
There is nothing wrong with example code. I tested it also in another react + meteor solution by grigio and everything works fine. |
@pronevich can you link to that code please? I want to see what it does. |
It seems to be an issue with the touchTap event: https://github.com/callemall/material-ui/blob/1790591cc2051b7c6c458cf7afc3271007b21c5c/src/date-picker/date-picker.jsx#L131 (that's the event that actually opens the dialog) I think to enable it you need the touch tap plugin: https://github.com/zilverline/react-tap-event-plugin I've tried installing that plugin, and it doesn't work yet - I might be doing something wrong. |
Ok, that's the issue - that plugin doesn't work. Going to look into this. |
I think it's a problem in meteor/browserify/exposify, I tried to load |
Yeah, I know what the issue is, fixing it today. |
OK, I have now definitively solved this issue with a brand new Browserify transform called |
I still get the same error mentioned way up there.
I am currently using externalify, just like @stubailo's last link suggests (and how the react-package examples suggest). The only difference is that I'm trying to make a package out of MUI. You can see my very small package here. It's also got a mini app for testing - just clone the repo and run meteor in the "demo" dir. |
#61 discusses this is as well |
Reopened primarily because there is a suspicion it doesn't work inside packages. I'll try it out later and report back. |
okay.. uhmm.. thanks to mrphu3074 I managed to get my package working by simply adding react as a dependency to the package. I do not know why the "owner, parent context" error does not appear anymore, this makes no sense bu it works.. I've also updated my package so you can have a try if you like. But it seems that we have a material-ui package now so this issue can be closed as far as I'm concerned. |
OK, will close again; if it comes up again we can revisit it. Eventually we will have support for NPM packages without |
you forgot to close. Could you link us to whatever this NPM fix is going to be? so I can keep an eye out. |
Sorry, there isn't anywhere to link to yet! |
For me (and Meteor 1.2.1), the above solution did not work. For material-ui, this Meteor package helped me, it works flawlessly: https://atmospherejs.com/markoshust/material-ui |
I almost went back to Rails. Thank you @stubailo for: https://github.com/meteor/react-packages/blob/master/docs/client-npm.md |
I'm running into the same issue… I must be doing something wrong with the way I set up my dependencies? Here's the repo: https://github.com/meteor-utilities/Meteor-Griddle |
@SachaG can you post a separate issue? This one is a bit long and about material UI. |
I tried to
meteor add react
and addmaterial-ui
viacosmos:browserify
but it seems the context is undefined.No problem with react and material-ui added via
cosmos:browserify
The text was updated successfully, but these errors were encountered: