We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88bfce3 commit a9f991bCopy full SHA for a9f991b
1 file changed
core/src/utils/theme.ts
@@ -649,7 +649,16 @@ const baselineUnit = 'rem';
649
* @returns The calculated CSS value string.
650
*/
651
export const dynamicFont = (size: number, unit: string | undefined = baselineUnit): string => {
652
- const baselinePixelSize = parseFloat((window as any).Ionic?.config?.get?.('theme')?.fontSizes?.root ?? 16);
+ let baselinePixelSize = 16;
653
+
654
+ if (typeof window !== 'undefined') {
655
+ const configRootFontSize = (window as any)?.Ionic?.config?.get?.('theme')?.fontSizes?.root;
656
657
+ const parsedSize = parseFloat(configRootFontSize);
658
+ if (!isNaN(parsedSize)) {
659
+ baselinePixelSize = parsedSize;
660
+ }
661
662
663
return `${size / baselinePixelSize}${unit}`;
664
};
0 commit comments