Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

830 B
Raw Blame
import type { ReactElement } from 'react'
import { type StyleProp, Text, type TextStyle } from 'react-native'

import { parseBold } from '@/lib/richText'

interface RichTextProps {
    text: string
    style?: StyleProp<TextStyle>
    boldStyle?: StyleProp<TextStyle>
}

export function RichText({ text, style, boldStyle }: RichTextProps): ReactElement {
    return (
        <Text style={style}>
            {parseBold(text).map((segment, index) =>
                segment.bold ? (
                    // biome-ignore lint/suspicious/noArrayIndexKey: segments are positional and never reorder
                    <Text key={index} style={boldStyle}>
                        {segment.text}
                    </Text>
                ) : (
                    segment.text
                )
            )}
        </Text>
    )
}