Saaj UI

useScreenDimensions

Get the current screen dimensions.

Installation

npx saaj add useScreenDimensions

Usage

MyComponent.tsx
import React from 'react';
import { View } from 'react-native';
 
import { useScreenDimensions } from '@/hooks/useScreenDimensions';
 
export function MyComponent() {
    const { width, height } = useScreenDimensions();
 
    return (
        <View
            style={{
                width,
                height,
                backgroundColor: 'red',
            }}
        >
            {/* ... */}
        </View>
    )
}

On this page