diff --git a/native/chat/inner-text-message.react.js b/native/chat/inner-text-message.react.js --- a/native/chat/inner-text-message.react.js +++ b/native/chat/inner-text-message.react.js @@ -105,7 +105,11 @@ style={[styles.message, cornerStyle]} animatedStyle={messageStyle} > - + {text} diff --git a/native/markdown/markdown.react.js b/native/markdown/markdown.react.js --- a/native/markdown/markdown.react.js +++ b/native/markdown/markdown.react.js @@ -5,6 +5,7 @@ import { View, Text, StyleSheet } from 'react-native'; import type { TextStyle as FlattenedTextStyle } from 'react-native/Libraries/StyleSheet/StyleSheet'; import * as SimpleMarkdown from 'simple-markdown'; +import tinycolor from 'tinycolor2'; import { onlyEmojiRegex } from 'lib/shared/emojis'; @@ -15,9 +16,10 @@ +style: TextStyle, +children: string, +rules: MarkdownRules, + +threadColor?: string, }; function Markdown(props: Props): React.Node { - const { style, children, rules } = props; + const { style, children, rules, threadColor } = props; const { simpleMarkdownRules, emojiOnlyFactor, container } = rules; const parser = React.useMemo( @@ -61,10 +63,10 @@ return { ...flattened, fontSize: fontSize * emojiOnlyFactor }; }, [emojiOnly, style, emojiOnlyFactor]); - const renderedOutput = React.useMemo( - () => output(ast, { textStyle, container }), - [ast, output, textStyle, container], - ); + const renderedOutput = React.useMemo(() => { + const color = tinycolor(threadColor).darken(20).toString(); + return output(ast, { textStyle, container, color }); + }, [ast, output, textStyle, container, threadColor]); if (container === 'Text') { return {renderedOutput}; diff --git a/native/markdown/rules.react.js b/native/markdown/rules.react.js --- a/native/markdown/rules.react.js +++ b/native/markdown/rules.react.js @@ -23,6 +23,7 @@ // View, and Views can't be nested inside Texts without explicit height and // width +container: 'View' | 'Text', + +color?: string, }; // Entry requires a seamless transition between Markdown and TextInput @@ -233,11 +234,16 @@ node: SharedMarkdown.SingleASTNode, output: SharedMarkdown.Output, state: SharedMarkdown.State, - ) => ( - - {output(node.content, state)} - - ), + ) => { + return ( + + {output(node.content, state)} + + ); + }, }, codeBlock: { ...SimpleMarkdown.defaultRules.codeBlock, diff --git a/native/markdown/styles.js b/native/markdown/styles.js --- a/native/markdown/styles.js +++ b/native/markdown/styles.js @@ -60,9 +60,7 @@ fontWeight: 'bold', }, blockQuote: { - backgroundColor: 'blockQuoteBackground', - borderLeftColor: 'blockQuoteBorder', - borderLeftWidth: 5, + borderRadius: 8, padding: 10, marginBottom: 6, marginVertical: 6,