From a59a3151ebdc5602956a79f56389ad736a1d6d44 Mon Sep 17 00:00:00 2001 From: Nir Hadassi Date: Mon, 9 Jul 2018 11:31:19 +0300 Subject: [PATCH] new version - 0.1.2 (#16) --- lib/scalingUtils.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scalingUtils.js b/lib/scalingUtils.js index ba45ffe..6c685be 100644 --- a/lib/scalingUtils.js +++ b/lib/scalingUtils.js @@ -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}; \ No newline at end of file diff --git a/package.json b/package.json index 449d6ec..f93c8ea 100644 --- a/package.json +++ b/package.json @@ -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": {