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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-adaptive-sizes

v1.0.0

Published

Responsive scaling utility for width, height, and font size without React Native or any dependencies.

Readme

React-Native-Adaptive-Sizes

A lightweight and dependency-free utility library for responsive scaling of UI elements including width, height, and font sizes.

Features

  • No dependencies
  • Width & height scaling
  • Font scaling with accessibility awareness
  • Device categorization helpers

Installation

npm install react-native-adaptive-sizes

Usage

First, set your screen dimensions (typically done once at app startup):

import { setScreenSize } from "react-native-adaptive-sizes";
import { Dimensions } from "react-native";

// Get the screen dimensions
const { width, height } = Dimensions.get("window");
const { fontScale } = Dimensions.get("screen");

// Set the screen size for the scaling utilities
setScreenSize({ width, height, fontScale });

Basic Scaling

import {
  scale,
  verticalScale,
  moderateScale,
} from "react-native-adaptive-sizes";

// Use in your styles
const styles = {
  container: {
    padding: scale(16),
    marginBottom: verticalScale(20),
    borderRadius: moderateScale(8),
  },
};

Percentage-Based Sizing

import { wp, hp } from "react-native-adaptive-sizes";

const styles = {
  banner: {
    width: wp(90), // 90% of screen width
    height: hp(20), // 20% of screen height
  },
};

Font Scaling

import { fontScale, fontScaleWithLimits } from "react-native-adaptive-sizes";

const styles = {
  title: {
    fontSize: fontScale(24),
  },
  subtitle: {
    // Min 16, max 22, respects system accessibility settings
    fontSize: fontScaleWithLimits(18, 16, 22, true),
  },
};

Device Detection

import { getDeviceInfo, deviceScale } from "react-native-adaptive-sizes";

// Get device information
const deviceInfo = getDeviceInfo();
if (deviceInfo.isTablet) {
  // Use tablet-specific layout
}

// Different values based on device size
const padding = deviceScale(
  10, // compact devices (< 375)
  12, // standard devices (375-394)
  14, // modern devices (395-419)
  16, // large devices (≥ 420)
  20 // tablets (optional)
);

API Reference

Core Functions

  • setScreenSize(size: ScreenSize): Sets the screen dimensions for scaling calculations
  • scale(size: number): Scales a value horizontally based on screen width
  • verticalScale(size: number): Scales a value vertically based on screen height
  • moderateScale(size: number, factor?: number): Scales with a moderation factor (default: 0.5)
  • moderateVerticalScale(size: number, factor?: number): Vertical scaling with moderation factor

Percentage Helpers

  • wp(percentage: number): Returns the given percentage of screen width
  • hp(percentage: number): Returns the given percentage of screen height

Font Scaling

  • fontScale(size: number, respectAccessibility?: boolean): Scales font size with accessibility support
  • fontScaleWithLimits(size: number, minSize?: number, maxSize?: number, respectAccessibility?: boolean): Font scaling with min/max constraints

Device Information

  • getDeviceInfo(): Returns object with device size information and categorization
  • deviceScale(compact: number, standard: number, modern: number, large: number, tablet?: number): Returns appropriate value based on device category