Browse Source

feat: adaptive font size

Oleksandr Honcharov 1 year ago
parent
commit
223c8bb566
2 changed files with 5 additions and 0 deletions
  1. 1 0
      src/utils/index.ts
  2. 4 0
      src/utils/responsive-font.ts

+ 1 - 0
src/utils/index.ts

@@ -1 +1,2 @@
 export * from './request';
+export * from './responsive-font';

+ 4 - 0
src/utils/responsive-font.ts

@@ -0,0 +1,4 @@
+import { PixelRatio } from 'react-native';
+
+const fontScale = PixelRatio.getFontScale();
+export const getFontSize = (size: number) => size / fontScale;