apply heading style to hashtags (#6710)
This commit is contained in:
parent
14cc74fdb9
commit
2eb52990ca
2 changed files with 9 additions and 3 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue