Quick Start
Get up and running in minutes
Quick Start
Follow these steps to add device geometry detection to your app.
Install the Package
yarn add react-native-device-geometrynpm install react-native-device-geometrypnpm add react-native-device-geometrybun add react-native-device-geometrySetup in Application
Install the native pods:
cd ios && pod installNote
This library requires native code integration. Use Expo Development Builds to include the native code.
Usage
Import the library and fetch the device geometry:
import { DeviceGeometry } from 'react-native-device-geometry';
async function getGeometry() {
const geometry = await DeviceGeometry.getGeometry();
console.log('Screen Width:', geometry.mainDisplay.metrics.width);
console.log('Has Cutout:', geometry.mainDisplay.cutouts.hasCutout);
}
getGeometry();