2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-21 13:24:11 +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
*
* 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'
);
}