From 3a6e58ba6ed037d14d7f8a68ec7d97448aa9a5ba Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 11 Mar 2024 12:54:51 -0700 Subject: Fix `lineHeight` problems on native with new `Text` (#3175) --- src/components/Typography.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/components/Typography.tsx') diff --git a/src/components/Typography.tsx b/src/components/Typography.tsx index c9ab7a8a1..5268e7f46 100644 --- a/src/components/Typography.tsx +++ b/src/components/Typography.tsx @@ -3,7 +3,7 @@ import {Text as RNText, TextStyle, TextProps as RNTextProps} from 'react-native' import {UITextView} from 'react-native-ui-text-view' import {useTheme, atoms, web, flatten} from '#/alf' -import {isIOS} from '#/platform/detection' +import {isIOS, isNative} from '#/platform/detection' export type TextProps = RNTextProps & { /** @@ -40,11 +40,11 @@ function normalizeTextStyles(styles: TextStyle[]) { const fontSize = s.fontSize || atoms.text_md.fontSize if (s?.lineHeight) { - if (s.lineHeight <= 2) { + if (s.lineHeight !== 0 && s.lineHeight <= 2) { s.lineHeight = Math.round(fontSize * s.lineHeight) } - } else { - s.lineHeight = fontSize + } else if (!isNative) { + s.lineHeight = s.fontSize } return s -- cgit 1.4.1