[FIX] Markdown links coloured same as normal text for old markdown (#4905)

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Reinaldo Neto 2023-03-16 11:12:46 -03:00 committed by GitHub
parent b4f8dfb84e
commit 00b8263913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>
);