File tree Expand file tree Collapse file tree 5 files changed +22
-1
lines changed
Expand file tree Collapse file tree 5 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ const styles = {
142142| engineVersion | string | returns engine version |
143143| getUA | string | returns user agent |
144144| deviceType | string | returns device type (e.g ` mobile ` or ` tablet ` ) |
145+ | isIOS13 | boolean | returns true/false if device is running on iOS13 |
146+ | isIPhone13 | boolean | returns true/false if device is iPhone and running on iOS13 |
147+ | isIPad13 | boolean | returns true/false if device is iPad and running on iOS13 |
148+ | isIPod13 | boolean | returns true/false if device is iPod and running on iOS13 |
149+ | isElectron | boolean | returns true/false if running on Electron |
145150| deviceDetect | function | return data object which includes all data about device (e.g version, engine, os etc.) |
146151
147152### Views
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ declare module "react-device-detect" {
5555 export import isIPad13 = ReactDeviceDetect . isIPad13 ;
5656 export import isIPhone13 = ReactDeviceDetect . isIPhone13 ;
5757 export import isIPod13 = ReactDeviceDetect . isIPod13 ;
58+ export import isElectron = ReactDeviceDetect . isElectron ;
5859 export import withOrientationChange = ReactDeviceDetect . withOrientationChange ;
5960}
6061
@@ -181,4 +182,6 @@ declare namespace ReactDeviceDetect {
181182 export const isIPhone13 : boolean ;
182183
183184 export const isIPod13 : boolean ;
185+
186+ export const isElectron : boolean ;
184187}
Original file line number Diff line number Diff line change @@ -414,6 +414,11 @@ var isIEType = function isIEType() {
414414 return browser . name === BROWSER_TYPES . INTERNET_EXPLORER || browser . name === BROWSER_TYPES . IE ;
415415} ;
416416
417+ var isElectronType = function isElectronType ( ) {
418+ var ua = navigator . userAgent . toLowerCase ( ) ;
419+ return ua . includes ( 'electron' ) ;
420+ } ;
421+
417422var getIOS13 = function getIOS13 ( ) {
418423 return ( / i P a d | i P h o n e | i P o d / . test ( navigator . platform ) || navigator . platform === "MacIntel" && navigator . maxTouchPoints > 1 ) && ! window . MSStream ;
419424} ;
@@ -508,6 +513,7 @@ var isIOS13 = getIOS13();
508513var isIPad13 = getIPad13 ( ) ;
509514var isIPhone13 = getIphone13 ( ) ;
510515var isIPod13 = getIPod13 ( ) ;
516+ var isElectron = isElectronType ( ) ;
511517
512518var AndroidView = function AndroidView ( _ref ) {
513519 var renderWithFragment = _ref . renderWithFragment ,
@@ -737,6 +743,7 @@ exports.isChrome = isChrome;
737743exports . isChromium = isChromium ;
738744exports . isConsole = isConsole ;
739745exports . isEdge = isEdge ;
746+ exports . isElectron = isElectron ;
740747exports . isFirefox = isFirefox ;
741748exports . isIE = isIE ;
742749exports . isIOS = isIOS ;
Original file line number Diff line number Diff line change 11{
22 "name" : " react-device-detect" ,
3- "version" : " 1.10 .11" ,
3+ "version" : " 1.11 .11" ,
44 "description" : " Detect device type and render your component according to it" ,
55 "main" : " main.js" ,
66 "typings" : " ./index.d.ts" ,
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ const isOperaType = () => browser.name === BROWSER_TYPES.OPERA;
4242const isIEType = ( ) =>
4343 browser . name === BROWSER_TYPES . INTERNET_EXPLORER ||
4444 browser . name === BROWSER_TYPES . IE ;
45+ const isElectronType = ( ) => {
46+ const ua = navigator . userAgent . toLowerCase ( )
47+
48+ return ua . includes ( 'electron' )
49+ }
4550
4651const getIOS13 = ( ) => {
4752 return (
@@ -101,3 +106,4 @@ export const isIOS13 = getIOS13()
101106export const isIPad13 = getIPad13 ( )
102107export const isIPhone13 = getIphone13 ( )
103108export const isIPod13 = getIPod13 ( )
109+ export const isElectron = isElectronType ( )
You can’t perform that action at this time.
0 commit comments