From 4ddd9e32652e104f8b8bcc0d090cd5decc2b245e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Thu, 24 Aug 2023 15:46:19 +0100 Subject: [PATCH] Migrate file to TS --- src/styles/{variables.js => variables.ts} | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) rename src/styles/{variables.js => variables.ts} (97%) diff --git a/src/styles/variables.js b/src/styles/variables.ts similarity index 97% rename from src/styles/variables.js rename to src/styles/variables.ts index 40e29ca3cf6e..168282829ba0 100644 --- a/src/styles/variables.js +++ b/src/styles/variables.ts @@ -6,11 +6,8 @@ import {PixelRatio} from 'react-native'; * This means that if you have text and its 'fontSize' is 19, the device font size changed to the 5th level on the iOS slider and the actual fontSize is 19 * PixelRatio.getFontScale() * = 19 * 1.11 = 21.09. Since we are disallowing font scaling we need to calculate it manually. We calculate it with: PixelRatio.getFontScale() * defaultValue > maxValue ? maxValue : * defaultValue * PixelRatio getFontScale() This means that the fontSize is increased/decreased when the device font size changes up to maxValue (second param) - * @param {Number} defaultValue - * @param {Number} maxValue - * @returns {Number} */ -function getValueUsingPixelRatio(defaultValue, maxValue) { +function getValueUsingPixelRatio(defaultValue: number, maxValue: number): number { return PixelRatio.getFontScale() * defaultValue > maxValue ? maxValue : defaultValue * PixelRatio.getFontScale(); } @@ -154,4 +151,4 @@ export default { qrShareHorizontalPadding: 32, baseMenuItemHeight: 64, -}; +} as const;