Skip to content

Commit a59a315

Browse files
authored
new version - 0.1.2 (#16)
1 parent 51cfb6b commit a59a315

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/scalingUtils.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Dimensions } from 'react-native';
22
const { width, height } = Dimensions.get('window');
3-
const [w, h] = width > height ? [height, width] : [width, height];
3+
const [shortDimension, longDimension] = width < height ? [width, height] : [height, width];
44

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

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

1313
export {scale, verticalScale, moderateScale};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-size-matters",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "A React-Native utility belt for scaling the size your apps UI across different sized devices",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)