Page MenuHomePhabricator

[native][fix] Fixed message height warnings on Android
ClosedPublic

Authored by kuba on Apr 19 2023, 3:48 AM.
Tags
None
Referenced Files
F2108631: D7518.id25455.diff
Tue, Jun 25, 1:40 PM
Unknown Object (File)
Thu, Jun 20, 1:45 AM
Unknown Object (File)
Sun, Jun 16, 3:57 AM
Unknown Object (File)
Fri, Jun 14, 6:57 AM
Unknown Object (File)
Mon, Jun 10, 2:16 AM
Unknown Object (File)
Fri, Jun 7, 5:25 AM
Unknown Object (File)
Thu, Jun 6, 6:01 PM
Unknown Object (File)
Thu, Jun 6, 4:06 PM
Subscribers

Details

Summary

Set the label's height to static value, to prevent message height warnings.

Test Plan

Run the app on iOS and Android. Created new chat and checked if the warnings appear:

  • new message,
  • edited message,
  • edited message with reaction,
  • not edited message with reaction/sidebar.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat requested changes to this revision.Apr 19 2023, 4:58 AM

We should source this height from the same place that we source it for message height calculations. Eg. see how timestampHeight is used. Please replace this with a variable that is also used somehow in messageItemHeight

This revision now requires changes to proceed.Apr 19 2023, 4:58 AM

Used constant in the styling

ashoat requested changes to this revision.Apr 20 2023, 11:35 AM
ashoat added inline comments.
native/chat/inline-engagement.react.js
246 ↗(On Diff #25455)

This appears to be a height constant, so it should be defined in a constant that is used in both height measurement and the definition here

343 ↗(On Diff #25455)

We should not be returning these things from the same file as it will break Fast Refresh – see here

This revision now requires changes to proceed.Apr 20 2023, 11:35 AM
native/chat/inline-engagement.react.js
31 ↗(On Diff #25455)

This should probably be defined in native/chat/chat-constants.js

High-level feedback here is that all numbers that contribute to the height of the component should be hard-coded as constants, and then the functions for determining the height of the component should simply sum those very same constants. This includes margin, padding, etc.

kuba marked 3 inline comments as done.

Address feedback

native/chat/inline-engagement.react.js
246 ↗(On Diff #25455)

I moved it to constants. It works similarly to inlineEngagementLeftStyle and other styles in chat-constants.js, without adding it to height measurement,

343 ↗(On Diff #25455)

Moved to the chat-constants.js.

ashoat requested changes to this revision.EditedApr 21 2023, 6:50 AM

It works similarly to inlineEngagementLeftStyle and other styles in chat-constants.js, without adding it to height measurement

Thanks for explaining, @kuba! Indeed I can see it works similarly to that... both inlineEngagementLeftStyle and your new inlineEngagementLabelStyle.topOffset are used to define styles, but are not used for height calculation.

One question before I accept – can you explain a little bit why inlineEngagementLeftStyle and inlineEngagementLabelStyle.topOffset are not used in height calculations?

Might be helpful to include visuals with lines indicating what these values handle, and how they are handled already elsewhere!

This revision now requires changes to proceed.Apr 21 2023, 6:50 AM

It works similarly to inlineEngagementLeftStyle and other styles in chat-constants.js, without adding it to height measurement

Thanks for explaining, @kuba! Indeed I can see it works similarly to that... both inlineEngagementLeftStyle and your new inlineEngagementLabelStyle.topOffset are used to define styles, but are not used for height calculation.

One question before I accept – can you explain a little bit why inlineEngagementLeftStyle and inlineEngagementLabelStyle.topOffset are not used in height calculations?

Might be helpful to include visuals with lines indicating what these values handle, and how they are handled already elsewhere!

It seems like the top prop is only an offset, which doesn't change the actual position (size) of the component, but only the position where the component is rendered.

I experimented a little bit, and here are the results:
Top offset: -5.

Screenshot 2023-04-21 at 16.35.09.png (976×740 px, 235 KB)

Top offset: 50

Screenshot 2023-04-21 at 16.33.54.png (891×716 px, 178 KB)

It changes the position where the label is displayed, but not where the component takes place.

Thanks for explaining!

This revision is now accepted and ready to land.Apr 21 2023, 7:53 AM