diff --git a/index.js b/index.js index 88ba6453..54533e9e 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,19 @@ import { setDefaultThemeStyle } from './init'; -import getTheme, { defaultThemeVariables, dimensionRelativeToIphone } from './theme'; +import getTheme, { + defaultThemeVariables, + dimensionRelativeToIphone, + calculateLineHeight, +} from './theme'; setDefaultThemeStyle(); // Theme -export { getTheme, defaultThemeVariables, dimensionRelativeToIphone }; +export { + getTheme, + defaultThemeVariables, + dimensionRelativeToIphone, + calculateLineHeight, +}; // Components export { ActionSheet } from './components/ActionSheet'; diff --git a/package.json b/package.json index 921f4adf..fdd4ab58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shoutem/ui", - "version": "2.0.17", + "version": "2.0.18", "description": "Styleable set of components for React Native applications", "dependencies": { "@shoutem/animation": "~0.12.4", diff --git a/theme.js b/theme.js index 4d984958..d05c7716 100644 --- a/theme.js +++ b/theme.js @@ -52,10 +52,16 @@ export function dimensionRelativeToIphone(dimension, actualRefVal = window.width return getSizeRelativeToReference(dimension, 375, actualRefVal); } +// This function is deprecated and replaced with calculateLineHeight. +// It remains present here because of the backward compatibility. export function formatLineHeight(fontSize) { // adds required padding to lineHeight to support // different alphabets (Kanji, Greek, etc.) + console.warn( + "formatLineHeight is deprecated and will be removed. Please use calculateLineHeight instead, it can simply be renamed as it takes the same argument and returns the same expected value, but more consistently across all fontSize." + ); + if (fontSize < 22) { // minimum lineHeight for different alphabets is 25 return 25; @@ -64,6 +70,10 @@ export function formatLineHeight(fontSize) { return (fontSize + 3); } +export function calculateLineHeight(fontSize) { + return (fontSize * 1.5); +} + export const defaultThemeVariables = { featuredColor: '#659CEC', backgroundColor: '#f2f2f2',