apply heading style to hashtags (#6710)

This commit is contained in:
Elias Nahum 2022-10-28 10:02:32 -03:00 committed by GitHub
parent 14cc74fdb9
commit 2eb52990ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -2,13 +2,13 @@
// See LICENSE.txt for license information.
import React from 'react';
import {Text, TextStyle} from 'react-native';
import {StyleProp, Text, TextStyle} from 'react-native';
import {popToRoot, dismissAllModals} from '@screens/navigation';
type HashtagProps = {
hashtag: string;
linkStyle: TextStyle;
linkStyle: StyleProp<TextStyle>;
};
const Hashtag = ({hashtag, linkStyle}: HashtagProps) => {

View file

@ -284,10 +284,16 @@ const Markdown = ({
return renderText({context, literal: `#${hashtag}`});
}
const linkStyle = [textStyles.link];
const headingIndex = context.findIndex((c) => c.includes('heading'));
if (headingIndex > -1) {
linkStyle.push(textStyles[context[headingIndex]]);
}
return (
<Hashtag
hashtag={hashtag}
linkStyle={textStyles.link}
linkStyle={linkStyle}
/>
);
};