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