App icon indicating copy to clipboard operation
App copied to clipboard

[$8000] Android/iOS - Code blocks are overflowing the app border

Open isagoico opened this issue 4 years ago • 123 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Issue is failing https://github.com/Expensify/App/pull/4624 (CC @parasharrajat)

Action Performed:

  1. Navigate to a conversation in iOS or Android
  2. Send a long message in a code block

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?

  • iOS
  • Android

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

isagoico avatar Aug 18 '21 17:08 isagoico

Triggered auto assignment to @iwiznia (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 18 '21 17:08 MelvinBot

: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:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

OSBotify avatar Aug 18 '21 17:08 OSBotify

@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.

parasharrajat avatar Aug 18 '21 18:08 parasharrajat

I am investigating it.

parasharrajat avatar Aug 18 '21 18:08 parasharrajat

Oh sorry about that, I think that this PR caused this then https://github.com/Expensify/App/pull/4047 cc @jsamr

iwiznia avatar Aug 18 '21 18:08 iwiznia

Wait, I am confused, that PR was deployed a while ago, was this broken before and we did not notice?

iwiznia avatar Aug 18 '21 18:08 iwiznia

Yes. this is the list of issues that were caused by that upgrade.

  1. https://github.com/Expensify/App/issues/4488.
  2. https://github.com/Expensify/App/issues/4377 . (What is wrong with Github? URLs for this issue and link pasted have the same id) notice 4377.
  3. Links were clickable from empty space. https://github.com/meliorence/react-native-render-html/issues/514
  4. And this one.

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.

parasharrajat avatar Aug 18 '21 18:08 parasharrajat

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.

parasharrajat avatar Aug 19 '21 11:08 parasharrajat

@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

isagoico avatar Aug 24 '21 23:08 isagoico

I think is happening on prod as well. so No deploy blocker.

Update:

  1. After applying the latest patch from the lib, this specific issue is not fixed. The library has moved a long way from the earlier version.
  2. I am still trying to find the best possible solution but currently, nothing seems to work.
  3. Next planned thing is to check the diff between older and newer versions and find the root cause. If the fix is patchable, I will approach the lib maintainers otherwise try to solve it with combinations of settings.

parasharrajat avatar Aug 24 '21 23:08 parasharrajat

Confirmed this is also happening in prod too in iOS. Removing the deploy blocker label.

isagoico avatar Aug 25 '21 01:08 isagoico

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.

parasharrajat avatar Aug 27 '21 16:08 parasharrajat

Did you have a revert PR to link @parasharrajat ? Or any update here?

johnmlee101 avatar Aug 30 '21 19:08 johnmlee101

Still on hold for N6

johnmlee101 avatar Sep 21 '21 20:09 johnmlee101

No update, still on hold

johnmlee101 avatar Oct 13 '21 19:10 johnmlee101

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.

parasharrajat avatar Oct 13 '21 19:10 parasharrajat

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!

MelvinBot avatar Nov 08 '21 19:11 MelvinBot

Is this still reproducible?

johnmlee101 avatar Dec 15 '21 19:12 johnmlee101

I think yes. But I haven't found any solution for it.

parasharrajat avatar Dec 15 '21 20:12 parasharrajat

Any update?

johnmlee101 avatar Jan 25 '22 18:01 johnmlee101

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.

parasharrajat avatar Jan 26 '22 01:01 parasharrajat

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.

jsamr avatar Jan 26 '22 15:01 jsamr

Awesome, I will keep eye on your blog.

parasharrajat avatar Jan 27 '22 03:01 parasharrajat

No update (?)

johnmlee101 avatar Mar 01 '22 21:03 johnmlee101

Same ^

johnmlee101 avatar Apr 05 '22 20:04 johnmlee101

None

johnmlee101 avatar May 11 '22 20:05 johnmlee101

Where are we with this?

johnmlee101 avatar Jun 15 '22 19:06 johnmlee101

Should I close this out?

johnmlee101 avatar Jul 20 '22 15:07 johnmlee101

No, let's export this, Please add the external label. Hopefully, we can get some ideas. I will be auto-assigned as C+.

parasharrajat avatar Jul 20 '22 16:07 parasharrajat

Triggered auto assignment to @bfitzexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

melvin-bot[bot] avatar Jul 20 '22 16:07 melvin-bot[bot]