rn-safe-area-utils
v1.0.4
Published
react-native safe-area safearea insets notch padding margin ios android ui layout
Downloads
27
Maintainers
Readme
rn-safe-area-utils
A lightweight utility library for React Native that makes working with safe area insets (notches, status bars, home indicators) super easy and developer-friendly.
✨ Features
- 🔹
useSafeInsets()→ get top, bottom, left, right inset values - 🔹
useSafePadding(edges)→ automatically apply padding for selected edges - 🔹
<SafeAreaWrapper />→ drop-in component to wrap screens with safe padding - ⚡ Minimal, dependency-light, and built on top of
react-native-safe-area-context
🚀 Installation
npm install rn-safe-area-utils react-native-safe-area-context
# or
yarn add rn-safe-area-utils react-native-safe-area-context
## 📖 Usage Examples
### 1. useSafeInsets
Get raw inset values:
```tsx
// App.tsx
import React from "react";
import { View, Text } from "react-native";
import { useSafeInsets } from "rn-safe-area-utils";
export default function Demo() {
const insets = useSafeInsets();
return (
<View style={{ paddingTop: insets.top, flex: 1, backgroundColor: "#fafafa" }}>
<Text>Top Inset: {insets.top}</Text>
<Text>Bottom Inset: {insets.bottom}</Text>
</View>
);
}