Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

step-scale

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

step-scale

React Native Scale Converters

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Step-Scale

npm PRsBadge npm npm

Scale your vertical and horizontal pixel sizes on different screens' dimensions, .. And More !

  • Scale pixel sizes on different screens' dimensions
  • Generate common styles' shapes in one line
  • Easily Get screen width and height.

Instalation

npm i step-scale - OR - yarn add step-scale

Then.. Your Are Done !

Usage

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

hScale: Horizontal Scaler.
vScale: Vertical Scaler.
fScale: FontSize Scaler.

*/
const styles = StyleSheet.create({

  myView: {
    width: hScale(150), 
    height: vScale(90),
    backgroundColor: "grey"
  },

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

})

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

sWidth: Screen Width value.
sHeight: Screen Height value.

*/
const styles = StyleSheet.create({

  myScreenContainer: {
    width: sWidth, 
    height: sHeight,
    backgroundColor: "grey"
  }

})

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

Shapes Generator
rcScale: generates scaled Rectangle.
sqScale: generates scaled Square.
crScale: generates scaled Circle.

Extra Size Scaler:
tScale: Total Size Scaler.

*/
const styles = StyleSheet.create({

  myBlueRecatngle: {
    // 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"
  },

})

Keywords

FAQs

Package last updated on 11 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc