UNPKG

react-native-ajora

Version:

The most complete AI agent UI for React Native

29 lines 1.27 kB
import katexPlugin from "@vscode/markdown-it-katex"; import React from "react"; import Markdown, { MarkdownIt } from "react-native-markdown-display"; // import MathJax from "react-native-mathjax-svg"; import { createMarkdownStyles } from "./markdownStyle"; const RichText = ({ text, isThinking = false, textColor: propTextColor, fontSize: propFontSize, lineHeight: propLineHeight, }) => { const theme = { colors: { icon: "black", textPrimary: "white", }, typography: { fontSize: { md: 16 }, }, }; const textColor = propTextColor || (isThinking ? theme.colors.icon : theme.colors.textPrimary); const fontSize = propFontSize || theme.typography.fontSize.md; const markdownStyle = createMarkdownStyles(textColor, { body: { fontSize, ...(propLineHeight && { lineHeight: propLineHeight }) }, text: { fontSize, ...(propLineHeight && { lineHeight: propLineHeight }) }, }); const markdownItInstance = MarkdownIt({ typographer: true }).use(katexPlugin, { containerClassName: "latex" }); return (<Markdown style={markdownStyle} markdownit={markdownItInstance}> {text} </Markdown>); }; export default RichText; //# sourceMappingURL=RichText.js.map