[HOLD for payment 2021-11-22] iPad - Text expands when changing to landscape mode
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:
- Navigate to a conversation
- Send a code block text like
hola - 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
Triggered auto assignment to @deetergp (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
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.
Triggered auto assignment to @mallenexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Triggered auto assignment to @AndrewGable (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Posted! https://www.upwork.com/jobs/~0191e5ec5589e5eeac Adding n6-hold label, we won't be merging this code for a week.
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 - Can you elaborate as to why this code was added and verify removing it doesn't break something else?
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.
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
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 Actually, with multi line text it is more noticeable the change of margin.

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

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

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.
I am leaning toward an issue with react-native-render-html as well, since WrappedText component is within the renderer of RenderHTMLConfigProvider
@jsamr might be able to help if you think it's an issue with that library.
@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...
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!
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.
@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 have you had a chance to look into?