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:
+5
-3
@@ -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'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user