Saaj UI

useInsets

Get the insets from the Unistyles Runtime.

Installation

npx saaj add useInsets

Usage

MyComponent.tsx
import React from 'react';
import { View } from 'react-native';
 
import { useInsets } from '@/hooks/useInsets';
 
export function MyComponent() {
    const { top, right, bottom, left } = useInsets();
 
    return (
        <View
            style={{
                paddingTop: top,
                paddingRight: right,
                paddingBottom: bottom,
                paddingLeft: left,
                backgroundColor: 'red',
            }}
        >
            {/* ... */}
        </View>
    )
}

On this page