@iotique/react-native-screen-corner-radius
v0.2.2
Published
A React Native library to get the Device's Screen's corner radius
Readme
react-native-screen-corner-radius
A React Native library to get the Device's Screen's corner radius.
Installation
npm install @iotique/react-native-screen-corner-radius
cd ios
pod installUsage
import { ScreenCornerRadius } from '@iotique/react-native-screen-corner-radius';
console.log(`Screen Corner Radius: ${ScreenCornerRadius}`);Android notes
- Units: Android returns density-independent pixels (dp), which match React Native points. iOS already returns values in points.
- Availability: Android 12 (API 31)+ only. On lower Android versions the value is 0 because rounded corner APIs are not available.
Values reported
On iOS 14.1, the follow values were reported for each device with rounded corners:
| Device | Value (pts) | | -------------------------------------------- | ----------- | | iPhone X / Xs / Xs Max / 11 Pro / 11 Pro Max | 39.0 | | iPhone Xr / 11 | 41.5 | | iPhone 12 mini / 13 mini | 44.0 | | iPhone 12 / 12 Pro / 13 Pro / 14 | 47.33 | | iPhone 12 Pro Max / 13 Pro Max / 14 Plus | 53.33 | | iPhone 15 / 15 Plus / 14 Pro / 14 Pro Max | 55.0 | | iPad Air / iPad Pro 11-inch / 12.9-inch | 18.0 |
Warning
On iOS, this uses a private API. Since Apple doesn't allow the usage of private APIs, the selector is somewhat obscured, which usually means it will get past app review. However, use at your own risk!
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Credits
- kylebshr/ScreenCorners for the Swift implementation
