Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Stag] Fix inline code font size in composer #39516

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ PODS:
- RNGoogleSignin (10.0.1):
- GoogleSignIn (~> 7.0)
- React-Core
- RNLiveMarkdown (0.1.35):
- RNLiveMarkdown (0.1.36):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
Expand Down Expand Up @@ -1904,7 +1904,7 @@ SPEC CHECKSUMS:
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 25b969a1ffc806b9f9ad2e170d4a3b049c6af85e
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
RNLiveMarkdown: aaf5afb231515d8ddfdef5f2928581e8ff606ad4
RNLiveMarkdown: e6312e556c522dd178728b28e132b16354789cb8
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
rnmapbox-maps: fcf7f1cbdc8bd7569c267d07284e8a5c7bee06ed
RNPermissions: 9b086c8f05b2e2faa587fdc31f4c5ab4509728aa
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@dotlottie/react-player": "^1.6.3",
"@expensify/react-native-live-markdown": "0.1.35",
"@expensify/react-native-live-markdown": "0.1.36",
"@expo/metro-runtime": "~3.1.1",
"@formatjs/intl-datetimeformat": "^6.10.0",
"@formatjs/intl-listformat": "^7.2.2",
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useMarkdownStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ function useMarkdownStyle(): MarkdownStyle {
},
code: {
fontFamily: FontUtils.fontFamily.platform.MONOSPACE,
fontSize: 13, // TODO: should be 15 if inside h1, see StyleUtils.getCodeFontSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, react-native-live-markdown supports only one fixed value for font size for each individual Markdown syntax style. However, the actual font size depends on whether the inline code is inside h1 or not:

/**
* Returns the font size for the HTML code tag renderer.
*/
function getCodeFontSize(isInsideH1: boolean) {
return isInsideH1 ? 15 : 13;
}

I suggest that we use 13 for now as we need more time to implement it properly on Live Markdown side.

Here's how it looks with 13:

Screenshot 2024-04-03 at 17 37 24

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thienlnam What do you think? Can we skip this edge case as for now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this seems fine to skip

color: theme.text,
backgroundColor: 'transparent',
},
pre: {
fontFamily: FontUtils.fontFamily.platform.MONOSPACE,
fontSize: 13,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've copied 13 from here:

App/src/styles/index.ts

Lines 185 to 193 in 7177173

pre: {
...baseCodeTagStyles(theme),
paddingVertical: 8,
paddingHorizontal: 12,
fontSize: 13,
fontFamily: FontUtils.fontFamily.platform.MONOSPACE,
marginTop: 0,
marginBottom: 0,
},

Perhaps we should expose it as variables.preFontSize?

color: theme.text,
backgroundColor: 'transparent',
},
Expand Down
Loading