summaryrefslogtreecommitdiff
path: root/frontend/app/utils/scale.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/utils/scale.js')
-rw-r--r--frontend/app/utils/scale.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/frontend/app/utils/scale.js b/frontend/app/utils/scale.js
new file mode 100644
index 0000000..f754d48
--- /dev/null
+++ b/frontend/app/utils/scale.js
@@ -0,0 +1,13 @@
+import { Dimensions } from 'react-native';
+
+const { width, height } = Dimensions.get('window');
+
+// Guideline sizes are based on standard ~5" screen mobile device
+const guidelineBaseWidth = 350;
+const guidelineBaseHeight = 680;
+
+const scale = size => (width / guidelineBaseWidth) * size;
+const scaleVertical = size => (height / guidelineBaseHeight) * size;
+const scaleModerate = (size, factor = 0.5) => size + ((scale(size) - size) * factor);
+
+export { scale, scaleVertical, scaleModerate };