@@ -1,6 +1,6 @@
{
"name": "react-photo-view",
- "version": "0.3.8",
+ "version": "0.3.9",
"description": "一款精致的 React 的图片预览组件",
"author": "MinJieLiu",
"license": "MIT",
@@ -1,7 +1,11 @@
/**
* 是否为移动端设备
*/
-const isMobile: boolean = typeof window !== 'undefined'
- && window.navigator.userAgent.includes('Mobile');
+const isMobile =
+ (typeof window !== 'undefined' &&
+ window.navigator &&
+ window.navigator.userAgent &&
+ window.navigator.userAgent.includes('Mobile')) ||
+ false;
export default isMobile;