From 2eb52990cad38e39a51043bdd4031e1affb2a7dd Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 28 Oct 2022 10:02:32 -0300 Subject: [PATCH] apply heading style to hashtags (#6710) --- app/components/markdown/hashtag/index.tsx | 4 ++-- app/components/markdown/markdown.tsx | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/components/markdown/hashtag/index.tsx b/app/components/markdown/hashtag/index.tsx index 5d40580eb..2090e8073 100644 --- a/app/components/markdown/hashtag/index.tsx +++ b/app/components/markdown/hashtag/index.tsx @@ -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; }; const Hashtag = ({hashtag, linkStyle}: HashtagProps) => { diff --git a/app/components/markdown/markdown.tsx b/app/components/markdown/markdown.tsx index b13f2c2ad..c24809906 100644 --- a/app/components/markdown/markdown.tsx +++ b/app/components/markdown/markdown.tsx @@ -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 ( ); };