Closed isagoico closed 8 months ago
Triggered auto assignment to @iwiznia (Engineering
), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash
deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
@iwiznia even reverting https://github.com/Expensify/App/pull/4624 PR does not fix this issue. This issue is caused by upgrading the react-native-render-html. And I am tracking multiple issues caused by that here meliorence/react-native-render-html#514.
I am investigating it.
Oh sorry about that, I think that this PR caused this then https://github.com/Expensify/App/pull/4047 cc @jsamr
Wait, I am confused, that PR was deployed a while ago, was this broken before and we did not notice?
Yes. this is the list of issues that were caused by that upgrade.
It is just due to one reason that a wrapper node was removed in the new lib version for optimizations which I think should be reverted.
Update, I have discussed this issue with the Lib owner and we are going to revert this change behind the flag which should fix the issue. It should be done by weekend.
@johnmlee101 @parasharrajat Should this issue still be considered a deploy blocker?
Update: Just as a double check, I just retested this and it's still happening
I think is happening on prod as well. so No deploy blocker.
Update:
Confirmed this is also happening in prod too in iOS. Removing the deploy blocker label.
Update: This is really giving me nuts. I tried a lot of things but still no luck.
Planned:
I will revert the code to the old version before the upgrade of RNRH and try to observe why it was working. Hoping this will help.
Did you have a revert PR to link @parasharrajat ? Or any update here?
Still on hold for N6
No update, still on hold
No update about the solution. But I ended with the conclusion that Using View inside the Text is not a good option Especially when you don't have control over the parent elements.
In this case, only words that extend beyond the width of the screen, will overflow.
At last, I will try to hack it but there are other priorities for me and this is yet on hold until N6.
This issue has not been updated in over 15 days. @johnmlee101, @parasharrajat eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Is this still reproducible?
I think yes. But I haven't found any solution for it.
Any update?
Oh. This is a long-dead issue. I completely forgot about this. Sorry, I have tried many solutions to adjust the UI but using only styling does not seem to be a solution anymore. I will try to find some tricks but truly saying existing implementation for code blocks rendering is already tricky. We can reopen this for others if needed, It will be some time before I can spend time on this again.
I am currently studying in details differences between CSS spec and React Native layout. Perhaps I will publish some material at some point; this morning I have been working on CSS inline formatting contexts VS React Native Text
layout.
The issue you are encountering is due to a lack of specification regarding layout of inline elements in React Native. Its layout engine, Yoga
, only attempts compliance with CSS flexible layout, but doesn't claim any support for CSS normal flow, which determines, among other things, how runs of text mixed with other inline elements should be displayed. Therefore, the Text
element creates an undocumented layout that resembles to some extent CSS inline layout. But its implementation is had-hoc and doesn't check against any kind of specification that I know of. For this very reason, it is also very prone to platform specifics. I have started collecting a few facts about behavioral divergence:
CSS inline-level element | React Native (Text child of Text) | React Native (View child of Text) |
---|---|---|
Inline margins are preserved. | ✘ | ✘ |
Inline paddings are preserved. | ✘ | ✔ |
Block margins are ignored. | ✔ | ✔ |
Block paddings are preserved. | ✘ | ✘ |
Block paddings/borders overflow the linebox*. | n/a | n/a |
Borders are preserved. | ✘ | ✔ |
Child text-runs are aligned to linebox baseline. | ✔ | ✘ |
Child text-runs can be fragmented**. | ✔ | ✘ |
* Unless for elements with an inline-block
display type.
** They can be broken to participate to different lineboxes.
Awesome, I will keep eye on your blog.
No update (?)
Same ^
None
Where are we with this?
Should I close this out?
No, let's export this, Please add the external label. Hopefully, we can get some ideas. I will be auto-assigned as C+.
Triggered auto assignment to @bfitzexpensify (External
), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
@bfitzexpensify was removed accidentally.
@parasharrajat Eep! 4 days overdue now. Issues have feelings too...
Bump @bfitzexpensify
Ah, missed this because of the unassignment.
Upwork job is here
Current assignee @parasharrajat is eligible for the Exported assigner, not assigning anyone new.
Triggered auto assignment to @Luke9389 (Exported
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Ok @parasharrajat I just want to summarize the history of this issue to be sure I understand. This (along with a few other issues) was caused by an update here. You were investigating it but hit a dead end. And now you're the C+ here?
Yup. you are correct.
OK perfect! Thanks for the clarification 😄
Doubled job to $500
Doubled to $1000
Doubled price to $2000.
Doubled price to $4000
Doubled again to $8000
I found a small problem with InlineCodeBlock
Currently, line text in InlineCode is set fixed, however if length word is too large example aaaaaaaaaaaaaaaxxxxxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
then when word wrap height is changed and so part of the text is hidden
I tried to remove the fixed height, and it worked
This current my code:
const codeWordWrapper = {
// height: 20, <--- comment this code
justifyContent: 'center',
};
const codeWordStyle = {
// height: 16, <--- comment this code
marginTop: 4, <--- top: 4 change to marginTop 4 to line separate
};
Before
After
I still don't understand the purpose of fixed height here. Please try again for me
Thanks for the proposal. It's been some time on this issue. Let me go refresh my memory on it and then I will review the proposal. It could take a day or two.
I will do this
@parasharrajat, @bfitzexpensify, @Luke9389 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Will do the review today.
Expect a response tomorrow daytime IST.
We will not modify the style of the InlineCodeBlock
at all, because as I understand InlineCodeBlock
the purpose of the words is on a single line and if it is too long, it will automatically break through a new line. However, if a word is too long, as I suggested before, it will be hidden because we had fixed the height of the block. So what do we do to solve it?
For words too long with a fixed length, I will change the logic for textMatrix
This problem is textMatrix
when the word is too long. If we find the word too long with a length greater than CONST.INLINE_BLOCK.MAX_CHARACTER
, we split it up and just push back in the textMatrix array.
My solve
In CONST.js
INLINE_BLOCK: { MAX_CHARACTER: 100, },
/**
* @param {String} text
* @param {Number} fontSize
* @returns {String[]}
*/
function splitText(text, fontSize) {
if (!text) return [];
const size = text.length * fontSize;
if (size > CONST.INLINE_BLOCK.MAX_CHARACTER) return text.split('');
return [text];
}
/**
* @param {Array<String[]>} matrixText
* @param {Number} fontSize
* @returns {Array<String[]>}
*/
function transformMatrixText(matrixText, fontSize) {
return matrixText.map((arrayText) => {
let newArray = [];
for (let i = 0; i < arrayText.length; i++) {
const splitResult = splitText(arrayText[i], fontSize);
newArray = [...newArray, ...splitResult];
}
return newArray;
});
}
....
const fontSize = lodashGet(props, 'textStyles.0.fontSize'); <-- I use fontSize to calculate width of word
const textMatrix = getTextMatrix(props.children);
const textMatrixTransformed = transformMatrixText(textMatrix, fontSize);
return (
<>
{_.map(textMatrixTransformed, (rowText, rowIndex) => (
Result Before:
After:
I think this to be pretty good because I tried it and saw how the markdown renderer looks like slack or github
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Issue is failing https://github.com/Expensify/App/pull/4624 (CC @parasharrajat)
Action Performed:
Expected Result:
Code block should be displayed in the area of the conversation.
Actual Result:
Code block is partially visible because is overflowing the app border.
Platform:
Where is this issue occurring?
Version Number: 1.0.86-2
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
View all open jobs on GitHub
Upwork Automation - Do Not Edit