diff --git a/lib/ScaledSheet.js b/lib/ScaledSheet.js index 2929a81..31814bb 100644 --- a/lib/ScaledSheet.js +++ b/lib/ScaledSheet.js @@ -1,7 +1,7 @@ import { StyleSheet } from 'react-native'; import deepMap from './deep-map'; -const validScaleSheetRegex = /^(\-?\d+(\.\d{1,3})?)@(ms(\d+(\.\d{1,2})?)?|s|vs|mvs)(r?)$/; +const validScaleSheetRegex = /^(\-?\d+(\.\d{1,3})?)@(ms(\d+(\.\d{1,2})?)?|mvs(\d+(\.\d{1,2})?)?|s|vs)(r?)$/; const scaleByAnnotation = (scale, verticalScale, moderateScale, moderateVerticalScale) => (value) => { if (!validScaleSheetRegex.test(value)) { @@ -29,8 +29,13 @@ const scaleByAnnotation = (scale, verticalScale, moderateScale, moderateVertical result = moderateVerticalScale(size); break; default: - const scaleFactor = value.split('ms')[1].replace('r', ''); - result = moderateScale(size, parseFloat(scaleFactor)); + if (value.includes('ms')) { + const scaleFactor = value.split('ms')[1].replace('r', ''); + result = moderateScale(size, parseFloat(scaleFactor)); + } else if (value.includes('mvs')) { + const scaleFactor = value.split('mvs')[1].replace('r', ''); + result = moderateVerticalScale(size, parseFloat(scaleFactor)); + } } return shouldRound ? Math.round(result) : result; diff --git a/package.json b/package.json index 85648db..06724ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-size-matters", - "version": "0.3.2", + "version": "0.3.3", "description": "A React-Native utility belt for scaling the size your apps UI across different sized devices", "main": "index.js", "scripts": {