-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix inline code blocks #2527
fix inline code blocks #2527
Conversation
borderTopLeftRadius: 0, | ||
borderBottomLeftRadius: 0, | ||
borderTopRightRadius: 0, | ||
borderBottomRightRadius: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just borderRadius: 0? Why does this have to be included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasperhuangg these style props take precedence over borderRadius
. Due to the reason we need to specify borderRadius
for Web, we can't remove it from the main code styles. But on native, the new implementation only wants border radius for the first and last word. Thus to override it, I have to be specific for each edge.
In Short, borderRadius
does not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parasharrajat Can we please DRY this up with the following module structure:
src/styles/codeStyles/
---| index.js // web/desktop/mWeb
---| defaultNativeCodeStyles.js // all the similar styles between iOS and Android
---| index.ios.js // import defaultNativeCodeStyles and override what you need
---| index.android.js // import defaultNativeCodeStyles and override what you need
Also, can you please test on all platforms and provide screenshots for each? Without more context, it seems weird to me that we would be exporting empty objects on web/desktop.
Sure. These styles are only for native platforms as web support the styling natively. I will provide screenshot for others as well. |
code block
's text is cropping
@roryabraham Merged the reverted changes here. Screenshots updated. Thanks. |
|
||
// Outer View is important to vertically center the Text | ||
<View | ||
// eslint-disable-next-line react/no-array-index-key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why this suppression is necessary? I'm confused because you are providing a key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Sorry. Just made few adjustments and forget to Change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, Eslint complains about an array index being used as key I know that is not the case but there is an error. So I had to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parasharrajat Can you clarify what you mean here? What is the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exact error was Array index can't be used as a key. so I have to disable it to use the array index in the key.
Co-authored-by: Rory Abraham <[email protected]>
…xpensify.cash into parasharrajat/quotedText
Updated. Thanks. |
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, besides the issue with eslint-disable-next-line
that Rory commented on.
@jasperhuangg actually eslint complaints about using the array index into the key, even though I am using the combination to create unique key. So I had to disable the warnings. |
@roryabraham Waiting for your input here. Sorry tagged you in a different issue, previously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM and tested well 👍
@jasperhuangg All yours. |
@jasperhuangg any input here. |
LGTM! merging |
🚀 Deployed to staging in version: 1.0.34-2🚀
|
🚀 Deployed to production in version: 1.0.39-5🚀
|
const codeTextStyle = { | ||
lineHeight: 15, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line height here was not enough and caused a regression #19922 when the inline code contains emojis.
function getTextMatrix(text) { | ||
return text.split('\n').map(row => _.without(row.split(/(\s)/), '')); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused a regression #19922 when using emojis and text the inline code will look misaligned #19922 (comment).
Please review.
Details
This PR also includes the reverted changes as per the comment #2307 (comment)
Problem
We (Including other contributors) tried using a combination of Text & View tag to achieve the above UI but there are a couple of issues as follows:
How I fixed it?
I had an idea of tokenizing the text. Then apply the style selectively. This is working well. I have made a small snap here.
Fixed Issues
Fixes #986
the issue found here https://github.com/Expensify/Expensify.cash/pull/2307#issuecomment-825308917#2307#issuecomment-824347903
Tests / QA Steps
This is a test to see
how code renders in the middle
of a sentence on mobile.Tested On
Screenshots
Web / Desktop
Mobile Web
Android
IOS