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
Unknown Object (File)
Mon, Oct 28, 1:44 AM
Unknown Object (File)
Sep 28 2024, 6:29 AM
Unknown Object (File)
Sep 28 2024, 6:29 AM
Unknown Object (File)
Sep 28 2024, 6:29 AM
Unknown Object (File)
Sep 28 2024, 6:29 AM
Unknown Object (File)
Sep 28 2024, 6:29 AM
Unknown Object (File)
Sep 28 2024, 6:22 AM
Unknown Object (File)
Sep 20 2024, 12:50 AM
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
Branch
kuba/messageediting
Lint
No Lint Coverage
Unit
No Test Coverage

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