https://github.com/tiaanduplessis/react-native-scaling-utils
Simple scaling utilities for React Native
https://github.com/tiaanduplessis/react-native-scaling-utils
react react-native scaling
Last synced: 11 months ago
JSON representation
Simple scaling utilities for React Native
- Host: GitHub
- URL: https://github.com/tiaanduplessis/react-native-scaling-utils
- Owner: tiaanduplessis
- License: mit
- Created: 2019-01-09T07:57:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-02T22:36:31.000Z (about 7 years ago)
- Last Synced: 2025-05-28T06:49:53.979Z (about 1 year ago)
- Topics: react, react-native, scaling
- Language: JavaScript
- Size: 29.3 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-scaling-utils
[](https://npmjs.org/package/react-native-scaling-utils)
[](https://npmjs.org/package/react-native-scaling-utils)
[](https://github.com/RichardLitt/standard-readme)
[](https://npmjs.org/package/react-native-scaling-utils)
[](http://makeapullrequest.com)
> Simple scaling utilities for React Native
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#License)
## Install
This project uses [node](https://nodejs.org) and [npm](https://www.npmjs.com).
```sh
$ npm install react-native-scaling-utils
$ # OR
$ yarn add react-native-scaling-utils
```
## Usage
```js
import {
screenHeight,
screenWidth,
scale,
isPortrait,
isLandscape,
removeDimensionsListener
} from 'react-native-scaling-utils'
console.log(screenHeight)
console.log(screenWidth)
console.log(scale.font(10))
console.log(scale.height(10)) // 10%
console.log(scale.width(50)) // 50%
console.log(isPortrait)
console.log(isLandscape)
removeDimensionsListener()
```
## Contribute
1. Fork it and create your feature branch: `git checkout -b my-new-feature`
2. Commit your changes: `git commit -am "Add some feature"`
3. Push to the branch: `git push origin my-new-feature`
4. Submit a pull request
## License
MIT