Skip to content

Commit b139836

Browse files
authored
Merge pull request #282 from vkarpov15/patch-1
Prevent crash when used with react-native
2 parents a4ce0ba + d39abed commit b139836

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

browser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ exports.colors = [
3939

4040
function useColors() {
4141
// is webkit? http://stackoverflow.com/a/16459606/376773
42-
return ('WebkitAppearance' in document.documentElement.style) ||
42+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
43+
return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||
4344
// is firebug? http://stackoverflow.com/a/398120/376773
4445
(window.console && (console.firebug || (console.exception && console.table))) ||
4546
// is firefox >= v31?

0 commit comments

Comments
 (0)