2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00

Merge pull request #731 from Viktor6713/master

Proper detection of react-native in isStandardBrowserEnv function
This commit is contained in:
Nick Uraltsev
2017-03-01 22:04:54 -08:00
committed by GitHub
+5 -3
View File
@@ -175,13 +175,15 @@ function trim(str) {
* typeof document -> undefined * typeof document -> undefined
* *
* react-native: * react-native:
* typeof document.createElement -> undefined * navigator.product -> 'ReactNative'
*/ */
function isStandardBrowserEnv() { function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
return false;
}
return ( return (
typeof window !== 'undefined' && typeof window !== 'undefined' &&
typeof document !== 'undefined' && typeof document !== 'undefined'
typeof document.createElement === 'function'
); );
} }