buraksakalli / react-native-aspect-ratio

πŸ“βœ¨ Effortlessly maintain aspect ratios in React Native layouts with this handy utility!

Home Page:https://www.npmjs.com/package/react-native-aspect-ratio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native Aspect Ratio Calculator

aspect-ratio

GitHub issues npm (scoped)

Installation

npm i react-native-aspect-ratio

Usage

Import the module

import { Screen } from "react-native-aspect-ratio";

Config

Set an width/height

  // You can use in your style.
  height: Screen.setDimension(90, "h", {411, 736}), // x, y values of designed component. x: 411, y: 736
  width: Screen.setDimension(80, 'w', {411, 736}),

Get full width/height

Returns screen width and height.

  height: Screen.getDimension().height,
  width: Screen.getDimension().width,

About

πŸ“βœ¨ Effortlessly maintain aspect ratios in React Native layouts with this handy utility!

https://www.npmjs.com/package/react-native-aspect-ratio

License:MIT License


Languages

Language:JavaScript 100.0%