Compare commits

...

2 Commits

Author SHA1 Message Date
Gleidson Daniel Silva 12c7c937a4
Merge branch 'develop' into fix.link-old-markdown 2023-02-14 14:12:14 -03:00
Reinaldo Neto 47ec3695dd [FIX] Markdown links coloured same as normal text for old markdown 2023-02-10 19:51:29 -03:00
5 changed files with 57 additions and 51 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -126,6 +126,12 @@ export const Links = () => (
<View style={styles.container}>
<Markdown msg='[Markdown link](https://rocket.chat): `[description](url)`' theme={theme} />
<Markdown msg='<https://rocket.chat|Formatted Link>: `<url|description>`' theme={theme} />
<Markdown msg='[Markdown link](https://rocket.chat) and the text with default style' theme={theme} />
<Markdown
msg='[Markdown link](https://rocket.chat) and the text with a color specific as auxiliaryText'
theme={theme}
style={[{ color: themes[theme].auxiliaryText }]}
/>
</View>
);

View File

@ -140,10 +140,10 @@ class Markdown extends PureComponent<IMarkdownProps, any> {
}
renderText = ({ context, literal }: { context: []; literal: string }) => {
const { numberOfLines, style = [] } = this.props;
const { numberOfLines } = this.props;
const defaultStyle = [this.isMessageContainsOnlyEmoji ? styles.textBig : {}, ...context.map(type => styles[type])];
return (
<Text accessibilityLabel={literal} style={[styles.text, defaultStyle, ...style]} numberOfLines={numberOfLines}>
<Text accessibilityLabel={literal} style={[styles.text, defaultStyle]} numberOfLines={numberOfLines}>
{literal}
</Text>
);
@ -193,12 +193,12 @@ class Markdown extends PureComponent<IMarkdownProps, any> {
};
renderParagraph = ({ children }: any) => {
const { numberOfLines, style, theme } = this.props;
const { numberOfLines, style = [], theme } = this.props;
if (!children || children.length === 0) {
return null;
}
return (
<Text style={[styles.text, style, { color: themes[theme!].bodyText }]} numberOfLines={numberOfLines}>
<Text style={[styles.text, { color: themes[theme!].bodyText }, ...style]} numberOfLines={numberOfLines}>
{children}
</Text>
);