react-native-device-info
Advanced tools
Comparing version 0.23.0 to 0.24.0
## Release Notes | ||
### next | ||
### 0.24.0 | ||
* Added `isLandscape()` (https://github.com/rebeccahughes/react-native-device-info/pull/504) | ||
@@ -5,0 +6,0 @@ ### 0.23.0 |
@@ -42,5 +42,6 @@ // should be imported this way: | ||
getFreeDiskStorage: () => number; | ||
getBatteryLevel: () => Promise<number> | ||
getBatteryLevel: () => Promise<number>; | ||
isLandscape: () => boolean; | ||
}; | ||
export default _default; |
/** | ||
* @providesModule react-native-device-info | ||
*/ | ||
import { Platform, NativeModules } from 'react-native'; | ||
import { Platform, NativeModules, Dimensions } from 'react-native'; | ||
@@ -242,2 +242,6 @@ var RNDeviceInfo = NativeModules.RNDeviceInfo; | ||
}, | ||
isLandscape: function() { | ||
const { height, width } = Dimensions.get('window'); | ||
return width >= height; | ||
} | ||
}; |
{ | ||
"name": "react-native-device-info", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"description": "Get device information using react-native", | ||
@@ -5,0 +5,0 @@ "main": "deviceinfo.js", |
@@ -236,3 +236,4 @@ # react-native-device-info | ||
| [isTablet()](#istablet) | `boolean` | ✅ | ✅ | ✅ | ? | | ||
| [hasNotch()](#hasNotch) | `boolean` | ✅ | ✅ | ✅ | ? | | ||
| [hasNotch()](#hasNotch) | `boolean` | ✅ | ✅ | ✅ | 0.23.0 | | ||
| [isLandscape()](#isLandscape) | `boolean` | ✅ | ✅ | ✅ | 0.24.0 | | ||
@@ -840,2 +841,12 @@ --- | ||
### isLandscape() | ||
Tells if the device is currently in landscape mode. | ||
**Examples** | ||
```js | ||
const isLandscape = DeviceInfo.isLandscape(); // true | ||
``` | ||
### hasNotch() | ||
@@ -842,0 +853,0 @@ |
@@ -41,3 +41,4 @@ /** | ||
freeDiskStorage: 0, | ||
getBatteryLevel: () => Promise.resolve(0) | ||
getBatteryLevel: () => Promise.resolve(0), | ||
isLandscape: false | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190980
352
926