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

Isomorphic apps cannot render this modal #24

Open
YarivGilad opened this issue Apr 3, 2016 · 6 comments
Open

Isomorphic apps cannot render this modal #24

YarivGilad opened this issue Apr 3, 2016 · 6 comments

Comments

@YarivGilad
Copy link

Please adjust this component to be able to render on the server for isomorphic (universal) apps.
This is becoming the standard now and it will be a shame not to use your component for lack of isomorphic support.
right now it throws an error because it has a dependency on document or window.
simply move the dependent code to componentDidMount...

@maxs15
Copy link

maxs15 commented Apr 6, 2016

+1

1 similar comment
@penguin3069
Copy link

+1

@YarivGilad
Copy link
Author

I was able to get it to run by monkey patching it which is not ideal...
I've download all the sources and modified modalFactory.js

var React = require('react');
var canUseDOM = !!(
  typeof window !== 'undefined' &&
  window.document &&
  window.document.createElement
);
var transitionEvents   = canUseDOM ? require('./transitionEvents')   : function() {};
var appendVendorPrefix = canUseDOM ? require('./appendVendorPrefix') : function() {};

then again in the actual Modal I was using... for example - OutlineModal.js

var React = require('react');
var modalFactory = require('../modalFactory');

var canUseDOM = !!(
  typeof window !== 'undefined' &&
  window.document &&
  window.document.createElement
);

var insertKeyframesRule = canUseDOM ? require('../insertKeyframesRule') : function() {} ;
var appendVendorPrefix  = canUseDOM ? require('../appendVendorPrefix')  : function() {} ;

@alexleventer
Copy link

+1

1 similar comment
@n0isy
Copy link

n0isy commented Sep 5, 2016

+1

@miracle2k
Copy link

I published a fixed version on npm as boron-ssr-fix.

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