Skip to content

Commit

Permalink
Migrate file to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioh8010 committed Aug 24, 2023
1 parent 329cac3 commit 4ddd9e3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/styles/variables.js → src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -154,4 +151,4 @@ export default {
qrShareHorizontalPadding: 32,

baseMenuItemHeight: 64,
};
} as const;

0 comments on commit 4ddd9e3

Please sign in to comment.