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

@gsalil/react-native-responsive-scale

v1.0.5

Published

Responsive React Native dimensions normalization helpers (wp/hp/fp/spV/spH)

Readme

@gsalil/react-native-responsive-scale

A lightweight utility for responsive layout normalization on React Native using iPhone 11 baselines.

Benefits

  • Consistent UI Across Devices: Normalizes dimensions to ensure your app looks great on various screen sizes and pixel densities.
  • Simplified Responsive Design: Provides easy-to-use functions for scaling widths, heights, fonts, and spacing without complex calculations.
  • Modern Baseline: Uses iPhone 11 (414x896) as the default baseline for contemporary design standards.
  • Customizable: Allows setting custom baselines to match your design system or target devices.
  • Performance Optimized: Lightweight with minimal overhead, using React Native's built-in APIs.
  • TypeScript Support: Fully typed for better development experience.

Installation

npm install @gsalil/react-native-responsive-scale

API

  • widthScale(size: number, options?: NormalizeOptions): number - Scale based on width
  • heightScale(size: number, options?: NormalizeOptions): number - Scale based on height
  • fontScale(size: number, options?: NormalizeOptions): number - Scale fonts based on width
  • verticalSpacing(size: number, options?: NormalizeOptions): number - Scale vertical spacing based on height
  • horizontalSpacing(size: number, options?: NormalizeOptions): number - Scale horizontal spacing based on width
  • normalize(size: number, based?: "width" | "height", options?: NormalizeOptions): number - Core normalization function
  • setGuidelineBase(width: number, height: number): void - Set custom baseline dimensions
  • getGuidelineBase(): { width: number; height: number } - Get current baseline
  • resetGuidelineBase(): void - Reset to default iPhone 11 baseline

Compatibility aliases:

  • wpwidthScale
  • hpheightScale
  • fpfontScale
  • spVverticalSpacing
  • spHhorizontalSpacing

Usage

Basic Usage with Aliases

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { wp, hp, fp, spV, spH } from '@gsalil/react-native-responsive-scale';

const App = () => {
  return (
    <View style={styles.container}>
      <View style={styles.card}>
        <Text style={styles.title}>Responsive Card</Text>
        <Text style={styles.subtitle}>This card scales perfectly on all devices</Text>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: spH(20), // Horizontal spacing
  },
  card: {
    width: wp(320), // Width percentage
    height: hp(200), // Height percentage
    paddingVertical: spV(16), // Vertical spacing
    paddingHorizontal: spH(12), // Horizontal spacing
    backgroundColor: '#fff',
    borderRadius: 8,
    shadowColor: '#000',
    shadowOffset: { width: 0, height: 2 },
    shadowOpacity: 0.1,
    shadowRadius: 4,
    elevation: 3,
  },
  title: {
    fontSize: fp(18), // Font scaling
    fontWeight: 'bold',
    marginBottom: spV(8),
  },
  subtitle: {
    fontSize: fp(14),
    color: '#666',
  },
});

export default App;

Default iPhone 11 baseline (414x896)

import {
  widthScale,
  heightScale,
  fontScale,
  verticalSpacing,
  horizontalSpacing,
} from "@gsalil/react-native-responsive-scale";

const buttonWidth = widthScale(200);
const textSize = fontScale(16);
const paddingVertical = verticalSpacing(12);
const marginHorizontal = horizontalSpacing(10);

Customize baseline for your design system

import {
  setGuidelineBase,
  widthScale,
  heightScale,
} from "@gsalil/react-native-responsive-scale";

setGuidelineBase(360, 760); // Android modern baseline, for example

const cardWidth = widthScale(320);
const cardHeight = heightScale(220);

One-off normalization override (no global state changed)

import { widthScale } from "@gsalil/react-native-responsive-scale";

const customValue = widthScale(120, { baseWidth: 375, baseHeight: 812 });

Restore default baseline

import { resetGuidelineBase } from "@gsalil/react-native-responsive-scale";
resetGuidelineBase();