luqin / react-icheck

:radio_button: iCheck components built with React. Highly customizable checkbox, radio buttons and radio group.
https://luqin.github.io/react-icheck
177 stars 40 forks source link

Fails on server side rendered pages #24

Open dderr opened 8 years ago

dderr commented 8 years ago

var _mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);

The line fails on isomorphic page loads when rendering on the server side since there is no browser environment.

at Object. (.../node_modules/react-icheck/lib/EnhancedSwitch.js:33:89) [1] at Module._compile (module.js:460:26) [1] at Module._extensions..js (module.js:478:10) [1] at require.extensions.(anonymous function) (.../node_modules/babel-register/lib/node.js:166:7) [1] at Object._module3.default._extensions.(anonymous function) [as .js](.../node_modules/webpack-isomorphic-tools/node_modules/require-hacker/babel-transpiled-modules/require hacker.js:250:71) [1] at Module.load (module.js:355:32) [1] at Module._load (module.js:310:12) [1] at Function.module._load (.../node_modules/piping/lib/launcher.js:32:16) [1] at Module.require (module.js:365:17) [1] at require (module.js:384:17)

luqin commented 8 years ago

Not support server side now. Welcome to push a PR.

jooj123 commented 8 years ago

This is fixed in this PR: https://github.com/luqin/react-icheck/pull/26