Skip to content

Commit

Permalink
Merge pull request #731 from Viktor6713/master
Browse files Browse the repository at this point in the history
Proper detection of react-native in isStandardBrowserEnv function
  • Loading branch information
nickuraltsev committed Mar 2, 2017
2 parents 161c616 + 5df39d8 commit 2f98d8f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/utils.js
Expand Up @@ -175,13 +175,15 @@ function trim(str) {
* typeof document -> undefined
*
* react-native:
* typeof document.createElement -> undefined
* navigator.product -> 'ReactNative'
*/
function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
return false;
}
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined' &&
typeof document.createElement === 'function'
typeof document !== 'undefined'
);
}

Expand Down

0 comments on commit 2f98d8f

Please sign in to comment.