FumadocsRN Device Geometry

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-geometry
npm install react-native-device-geometry
pnpm add react-native-device-geometry
bun add react-native-device-geometry

Setup in Application

Install the native pods:

cd ios && pod install

Note

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();