Skip to content

Commit 8f63a4f

Browse files
authored
Merge pull request Expensify#64048 from software-mansion-labs/@szymczak/fix-link-in-rbr-font-size
Fix link in RBR font size
2 parents b081a39 + 5de1c2b commit 8f63a4f

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function AnchorRenderer({tnode, style, key}: AnchorRendererProps) {
9696
linkStyle = [
9797
styles.link,
9898
{
99-
fontSize: styles.textMicro.fontSize,
99+
fontSize: HTMLEngineUtils.getFontSizeOfRBRChild(tnode),
100100
textDecorationLine: 'underline',
101101
},
102102
];

src/components/HTMLEngineProvider/htmlEngineUtils.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {TNode} from 'react-native-render-html';
2+
import variables from '@styles/variables';
23

34
type Predicate = (node: TNode) => boolean;
45

@@ -84,4 +85,17 @@ function isChildOfRBR(tnode: TNode): boolean {
8485
return isChildOfRBR(tnode.parent);
8586
}
8687

87-
export {computeEmbeddedMaxWidth, isChildOfComment, isChildOfH1, isDeletedNode, isChildOfTaskTitle, isChildOfRBR, isCommentTag};
88+
function getFontSizeOfRBRChild(tnode: TNode): number {
89+
if (!tnode.parent) {
90+
return 0;
91+
}
92+
if (tnode.parent.tagName === 'rbr' && tnode.parent.attributes?.issmall !== undefined) {
93+
return variables.fontSizeSmall;
94+
}
95+
if (tnode.parent.tagName === 'rbr' && tnode.parent.attributes?.issmall === undefined) {
96+
return variables.fontSizeLabel;
97+
}
98+
return 0;
99+
}
100+
101+
export {computeEmbeddedMaxWidth, isChildOfComment, isChildOfH1, isDeletedNode, isChildOfTaskTitle, isChildOfRBR, isCommentTag, getFontSizeOfRBRChild};

0 commit comments

Comments
 (0)