Fixes to lineheight on web to counteract emoji issues
This commit is contained in:
@@ -1,22 +1,25 @@
|
||||
import React from 'react'
|
||||
import {Text as RNText, TextProps} from 'react-native'
|
||||
import {s} from 'lib/styles'
|
||||
import {s, lh} from 'lib/styles'
|
||||
import {useTheme, TypographyVariant} from 'lib/ThemeContext'
|
||||
|
||||
export type CustomTextProps = TextProps & {
|
||||
type?: TypographyVariant
|
||||
lineHeight?: number
|
||||
}
|
||||
|
||||
export function Text({
|
||||
type = 'md',
|
||||
children,
|
||||
lineHeight,
|
||||
style,
|
||||
...props
|
||||
}: React.PropsWithChildren<CustomTextProps>) {
|
||||
const theme = useTheme()
|
||||
const typography = theme.typography[type]
|
||||
const lineHeightStyle = lineHeight ? lh(theme, type, lineHeight) : undefined
|
||||
return (
|
||||
<RNText style={[s.black, typography, style]} {...props}>
|
||||
<RNText style={[s.black, typography, lineHeightStyle, style]} {...props}>
|
||||
{children}
|
||||
</RNText>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user