about summary refs log tree commit diff
path: root/src/view/com/util/text/Text.tsx
blob: c3a8a2194c984d05723f542c857d428e83ceae57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import React from 'react'
import {Text as RNText, TextProps} from 'react-native'
import {s} from '../../../lib/styles'
import {useTheme, TypographyVariant} from '../../../lib/ThemeContext'

export type CustomTextProps = TextProps & {
  type?: TypographyVariant
}

export function Text({
  type = 'md',
  children,
  style,
  ...props
}: React.PropsWithChildren<CustomTextProps>) {
  const theme = useTheme()
  const typography = theme.typography[type]
  return (
    <RNText style={[s.black, typography, style]} {...props}>
      {children}
    </RNText>
  )
}