boron icon indicating copy to clipboard operation
boron copied to clipboard

Isomorphic apps cannot render this modal

Open YarivGilad opened this issue 8 years ago • 6 comments

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...

YarivGilad avatar Apr 03 '16 10:04 YarivGilad

+1

maxs15 avatar Apr 06 '16 21:04 maxs15

+1

penguin3069 avatar Apr 24 '16 04:04 penguin3069

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() {} ;

YarivGilad avatar Apr 24 '16 09:04 YarivGilad

+1

alexleventer avatar Aug 07 '16 22:08 alexleventer

+1

n0isy avatar Sep 05 '16 10:09 n0isy

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

miracle2k avatar Mar 27 '17 13:03 miracle2k