Skip to content

Commit

Permalink
new version - 0.1.2 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirsky authored Jul 9, 2018
1 parent 51cfb6b commit a59a315
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/scalingUtils.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Dimensions } from 'react-native';
const { width, height } = Dimensions.get('window');
const [w, h] = width > height ? [height, width] : [width, height];
const [shortDimension, longDimension] = width < height ? [width, height] : [height, width];

//Guideline sizes are based on standard ~5" screen mobile device
const guidelineBaseWidth = 350;
const guidelineBaseHeight = 680;

const scale = size => w / guidelineBaseWidth * size;
const verticalScale = size => h / guidelineBaseHeight * size;
const scale = size => shortDimension / guidelineBaseWidth * size;
const verticalScale = size => longDimension / guidelineBaseHeight * size;
const moderateScale = (size, factor = 0.5) => size + ( scale(size) - size ) * factor;

export {scale, verticalScale, moderateScale};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-size-matters",
"version": "0.1.1",
"version": "0.1.2",
"description": "A React-Native utility belt for scaling the size your apps UI across different sized devices",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a59a315

Please sign in to comment.