Isomorphic apps cannot render this modal
Opened this issue · 6 comments
YarivGilad commented
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 commented
+1
penguin3069 commented
+1
YarivGilad commented
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 commented
+1
n0isy commented
+1
miracle2k commented
I published a fixed version on npm as boron-ssr-fix.