App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-11-22] iPad - Text expands when changing to landscape mode

Open isagoico opened this issue 5 years ago • 39 comments

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


Action Performed:

  1. Navigate to a conversation
  2. Send a code block text like hola
  3. Change iPad orientation to landscape

Expected Result:

Orientation should change to landscape without any visual funkyness

Actual Result:

The message expands and has a weird behaviour when changing to landscape.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platform:

Where is this issue occurring?

  • iOS (iPad)

Version Number: 1.0.99-0

Reproducible in staging?: yes Reproducible in production?: yes

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/44479856/133688410-7066a76d-9bae-41e9-a3cb-a18aab8f11b4.MP4

Expensify/Expensify Issue URL:

Issue reported by: @Santhosh-Sellavel Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1631727437345200

View all open jobs on GitHub

isagoico avatar Sep 16 '21 21:09 isagoico

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

MelvinBot avatar Sep 16 '21 21:09 MelvinBot

Nice find! I can confirm it happens when going from landscape to portrait as well. Also happens on iPhone. This definitely strikes me as something that can be worked on by an external contributor.

deetergp avatar Sep 16 '21 22:09 deetergp

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

MelvinBot avatar Sep 16 '21 22:09 MelvinBot

Triggered auto assignment to @AndrewGable (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Sep 18 '21 00:09 MelvinBot

Posted! https://www.upwork.com/jobs/~0191e5ec5589e5eeac Adding n6-hold label, we won't be merging this code for a week.

mallenexpensify avatar Sep 18 '21 00:09 mallenexpensify

Proposal

The codeWrapper style for iOS has a marginTop of 2, by removing this margin it will prevent this bug to keep happening and it doesn't affect the style while rendering it. This margin is only set for iOS that is why its happening only in iOS.

https://github.com/Expensify/App/blob/fc37f6d42bd1133b32f7a8609b35cef64c2c9afa/src/styles/codeStyles/index.ios.js#L1-L5

AlfredoAlc avatar Sep 21 '21 18:09 AlfredoAlc

@AlfredoAlc - Can you elaborate as to why this code was added and verify removing it doesn't break something else?

AndrewGable avatar Sep 21 '21 21:09 AndrewGable

This style is used in the WrappedText component only for native apps(in the case of this change only ios), to render the code block container styling. Since it interacts with RenderHTML which changes his props when the screen with changes(changing to landscape). It might cause to render extra spacing if a margin is set.

I will attach some screenshots to compare how it renders with and without the margin.

Compare

I don't see anything breaking, only the slight change in the margin also will attach some videos for both iPhone and iPad comparing.

https://user-images.githubusercontent.com/53409604/134263181-1e204604-e13e-4b65-a006-e9980b91b685.mp4

https://user-images.githubusercontent.com/53409604/134263184-daa5bc8d-b3b6-4ade-8fff-398d6b4fb243.mp4

https://user-images.githubusercontent.com/53409604/134263462-1c90d3b5-f4cc-4d63-bf2c-ef0f7093d87f.mp4

AlfredoAlc avatar Sep 22 '21 00:09 AlfredoAlc

Nice catch it is possible that that margin is causing the issue but could you please check the multi line text with inline code blocks in it. Use code blocks that fit in a line and code blocks that wrap multi line in a single paragraph. Lets see what is the result.

Moreover, styling should not have such side-effects. This issue should be fixed either in react native render html lib or logic where we calculate the row height in the chat list.

parasharrajat avatar Sep 22 '21 00:09 parasharrajat

@parasharrajat Actually, with multi line text it is more noticeable the change of margin. Screen Shot 2021-09-21 at 17 35 54

AlfredoAlc avatar Sep 22 '21 00:09 AlfredoAlc

Let's try this message with `inline code` & big blocks that `wrap multiple lines containing multiple code blocks`. You would see the difference.

Could you please paste this text?

parasharrajat avatar Sep 22 '21 00:09 parasharrajat

Yes, now I see the difference. I saw that for android is working fine and there is aheight of 20 instead of 18 set in ios. I attached screenshots comparing removing the margin and changing the height to 20. Screen Shot 2021-09-21 at 18 01 45

Also, if the margin is set, it renders weird the text you sent me, when changing to landscape. See attached image.

Simulator Screen Shot - iPhone 12 - 2021-09-21 at 18 05 48

AlfredoAlc avatar Sep 22 '21 01:09 AlfredoAlc

Thanks for testing it. It is just that we need to test different combinations and adjust this so that everything looks fine.

If your solution fixes this issue and does not break the rendering of inline code blocks then its good.

But I know somewhere that CSS| Styles should not break the layout. (Now there are two things that must be causing the issue, Either react-native-render-html is not working properly or we are not able to determine the row height correctly. Although, this fixes the issue the root cause will remain unfixed (if this is not the root cause, IMO).

Maybe we should wait to see more proposals and who knows what one can come up with.

parasharrajat avatar Sep 22 '21 01:09 parasharrajat

I am leaning toward an issue with react-native-render-html as well, since WrappedText component is within the renderer of RenderHTMLConfigProvider

AlfredoAlc avatar Sep 22 '21 01:09 AlfredoAlc

@jsamr might be able to help if you think it's an issue with that library.

AndrewGable avatar Sep 30 '21 19:09 AndrewGable

@AndrewGable Hi Andrew! I have not seen this bug while using RNRH; plus we don't have height depending on width kind of relationships in the codebase, so I highly doubt it would come from the lib...

jsamr avatar Oct 07 '21 09:10 jsamr

Thank you for that confirmation @jsamr - For your reference @AlfredoAlc, @jsamr is a lead contributor and subject expert in the react-native-render-html library. If you have any other leads let's definitely explore them @AlfredoAlc!

AndrewGable avatar Oct 07 '21 21:10 AndrewGable

Please refer to this post for updated information on the n6 hold, we've raised the bonus to $250 for all issues where a PR is created before the N6 hold is lifted.

kadiealexander avatar Oct 08 '21 01:10 kadiealexander

@AndrewGable I will take a deeper look to find out the root of this problem.

FYI, @jsamr actually the margin prop it what seems to be causing the bug.

AlfredoAlc avatar Oct 08 '21 17:10 AlfredoAlc

@AlfredoAlc have you had a chance to look into?

mallenexpensify avatar Oct 18 '21 22:10 mallenexpensify