npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-smart-dimension

v1.0.7

Published

A simple and lightweight React Native library for responsive dimensions, scaling, and adaptive UI design.

Readme

React Native Smart dimension

react-native-smart-dimension is a lightweight and flexible library for handling responsive design in React Native applications. It provides hooks to manage device types, screen dimension, and scalable layouts for various screen sizes, including mobile and tablet devices.

Installation

You can install the library using npm or yarn:

npm install react-native-smart-dimension

or

yarn add react-native-smart-dimension

Features

  • Detects device type (mobile or tablet)
  • Provides responsive height, width, and font scaling utilities
  • Listens for screen dimension changes in real-time
  • Supports percentage-based and font scaling calculations
  • Optimized for React Native projects

Usage

1. Detect Device Type

import { useDeviceType } from "react-native-smart-dimension";

const { isTablet, platform } = useDeviceType();
console.log(`Device Type: ${isTablet ? "Tablet" : "Mobile"}, Platform: ${platform}`);

2. Listen to Screen Dimension Changes

import { usedimensionListener } from "react-native-smart-dimension";

const { screen, window } = usedimensionListener();
console.log("Window dimension:", window);
console.log("Screen dimension:", screen);

3. Responsive Height & Width

import { useResponsiveHeight, useResponsiveWidth } from "react-native-smart-dimension";

const height = useResponsiveHeight(50); // 50% of window height
const width = useResponsiveWidth(80); // 80% of window width

4. Responsive Font Size

import { useResponsiveFontSize } from "react-native-smart-dimension";

const fontSize = useResponsiveFontSize(2); // Scales based on screen size

5. Table View Layout Helper

import { useTableView } from "react-native-smart-dimension";

const { columnWidth, gap } = useTableView(3, 5); // 3 columns with 5% gap

API Reference

useDeviceType()

Returns an object with:

  • isTablet (boolean) – Whether the device is a tablet
  • platform (string) – Platform type (ios or android)

usedimensionListener()

Returns an object with:

  • screen – Full screen dimension
  • window – Usable window dimension

useResponsiveHeight(value: number)

Calculates the responsive height based on percentage.

useResponsiveWidth(value: number)

Calculates the responsive width based on percentage.

useResponsiveFontSize(value: number)

Scales the font size based on screen dimension.

useTableView(totalColumns: number, gapPercentage: number)

Returns column width and gap based on total columns and percentage gap.

percentageCalculation(max: number, val: number)

Utility function to calculate percentage-based dimension.

fontCalculation(height: number, width: number, val: number)

Utility function to calculate font size based on aspect ratio.

Contributing

Pull requests and contributions are welcome! Feel free to improve this library and make it better for everyone.

License

MIT License