Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How do you get the font stylings for a component in Native Base

$
0
0

I want to use the same style for the text for Heading at 2xl, xl, md in react native markdown renderer/display

Right now I am doing something like this

  const { colorMode } = useColorMode();  const [headingColor, bodyColor] = useToken("colors", [    components.Heading.baseStyle({ colorMode }).color,    components.Text.baseStyle({ colorMode }).color,  ]);  const [headingFontWeight, bodyFontWeight] = useToken("fontWeights", [    components.Heading.baseStyle({ colorMode }).fontWeight,    components.Text.baseStyle({ colorMode }).fontWeight,  ]);...      style={{        heading1: {          color: headingColor,          fontSize: fontSizes.xl,          letterSpacing: letterSpacings.xl,          fontWeight: headingFontWeight.toString(),        },        heading2: {          color: headingColor,          fontSize: fontSizes.lg,          letterSpacing: letterSpacings.lg,          fontWeight: headingFontWeight.toString(),        },        body: {          color: bodyColor,          fontSize: fontSizes.md,          letterSpacing: letterSpacings.md,          fontWeight: bodyFontWeight.toString(),        },        code_block: { color: bodyColor, backgroundColor: "transparent" },        code_inline: { color: bodyColor, backgroundColor: "transparent" },      }}

but it is getting a bit tedious. Is there something along the lines of getTextStyles(theme.components.Header, "2xl")


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>