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-scales

v1.0.2

Published

React Native Scales Converters

Readme

React Native Scales

npm PRsBadge npm npm

Scale UI elements dynamically based on screen dimensions for a consistent look across devices!

This package helps you:

  • Scale pixel sizes proportionally based on different screen dimensions.
  • Maintain consistent UI elements across devices, including tablets and foldable screens.
  • Generate common shape styles with just one line of code.
  • Easily access screen width and height.

Installation

Use either of the following commands to install:

npm i react-native-scales

- OR -

yarn add react-native-scales

That's it! You're ready to go. 🎉


📌 Usage

Basic Scalers

These functions scale sizes dynamically based on the screen dimensions.

import { StyleSheet } from "react-native"
import { hScale, vScale, fScale } from "react-native-scales"
 
/*
Basic Scalers:

hScale: Horizontal Scaler (width-based).
vScale: Vertical Scaler (height-based, with limits to prevent extreme stretching).
fScale: FontSize Scaler (adjusts text size for readability).
*/

const styles = StyleSheet.create({
  myView: {
    width: hScale(150), 
    height: vScale(90),
    backgroundColor: "grey"
  },

  myText: {
    fontSize: fScale(15),
    color: "green"
  }
})

Constants

Access screen dimensions directly.

import { StyleSheet } from "react-native"
import { sWidth, sHeight } from "react-native-scales"
 
/*
Constants:

sWidth: Screen width.
sHeight: Screen height (adjusted for Android status bar).
*/

const styles = StyleSheet.create({
  myScreenContainer: {
    width: sWidth, 
    height: sHeight,
    backgroundColor: "grey"
  }
})

Extras

Generate common shapes quickly and use an advanced total size scaler.

import { StyleSheet } from "react-native"
import { rcScale, sqScale, crScale, tScale } from "react-native-scales"
 
/*
Extras:

Shapes Generator:
rcScale: Generates a scaled rectangle.
sqScale: Generates a scaled square.
crScale: Generates a scaled circle.

Advanced Scaler:
tScale: Uses screen diagonal to create balanced scaling.
*/

const styles = StyleSheet.create({
  myBlueRectangle: {
    // Params: (width, height)
    ...rcScale(150, 90),
    backgroundColor: "blue"
  },

  myGreenSquare: {
    ...sqScale(150),
    backgroundColor: "green"
  },

  myRedCircle: {
    ...crScale(150),
    backgroundColor: "red"
  },

  myView: {
    width: tScale(1.5), 
    height: tScale(2.9),
    backgroundColor: "grey"
  },
})

💡 Why Use This?

✔️ Prevents UI distortion – Avoids excessive stretching on tall screens.
✔️ Works on all devices – Adapts elements for phones, tablets, and foldables.
✔️ Improves readability – Ensures fonts scale naturally.
✔️ Saves development time – Generate scaled shapes with one function.


📢 Contributing

We welcome contributions! Feel free to open pull requests or issues.