Skip to content

Commit

Permalink
[native] fix forcing the incorrect height for text messages
Browse files Browse the repository at this point in the history
Summary:
This diff is part 2/3 to fix forcing the incorrect height for messages with inline engagement in prod.

This [[ https://linear.app/comm/issue/ENG-4606/fix-forcing-incorrect-height-for-messages-with-inline-engagement-in | linear ]] comment explains this issue and what I did to address this

> Since item.contentHeight is now the height of the inner text message AND the height of the inline engagement we are now forcing the wrong height for the inner text message component. An idea I want to explore to address this is to force the height higher up in the component tree (somewhere like ComposedMessage) where both the "inner message" and the inline engagement is rendered so that when we force the height withitem.contentHeight, it is correct

Depends on D8797

Test Plan:
Please see demo video where I force and unforce the correct height of the text message and it did not change visually (outside of the green background) and I did not get any error logs talking about incorrect height measurements, I also purposely force an incorrect height (which resulted in some logs about incorrect height measurements.

Also please note for the video, I set a green background so that it is easier to visually see what is happening, but these are only for the demo videos

With the correct height measurement:
{F686532}

With the incorrect height measurement:
{F686546}

Reviewers: atul, kamil, tomek, ashoat

Reviewed By: ashoat

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8798
  • Loading branch information
ginsueddy committed Aug 15, 2023
1 parent 1a2ed56 commit 14a2d48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 10 additions & 1 deletion native/chat/composed-message.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,22 @@ class ComposedMessage extends React.PureComponent<Props> {
);
}

const viewStyle = [styles.alignment];
if (!__DEV__) {
// We don't force view height in dev mode because we
// want to measure it in Message to see if it's correct
if (item.messageShapeType === 'text') {
viewStyle.push({ height: item.contentHeight });
}
}

return (
<View {...viewProps}>
<AnimatedView style={{ opacity: contentAndHeaderOpacity }}>
<MessageHeader item={item} focused={focused} display="lowContrast" />
</AnimatedView>
<AnimatedView style={[containerStyle, editedMessageStyle]}>
<View style={styles.alignment}>
<View style={viewStyle}>
<View style={[styles.content, alignStyle]}>
{deliveryIcon}
{messageBox}
Expand Down
6 changes: 0 additions & 6 deletions native/chat/inner-text-message.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ function InnerTextMessage(props: Props): React.Node {

const cornerStyle = getRoundedContainerStyle(filterCorners(allCorners, item));

if (!__DEV__) {
// We don't force view height in dev mode because we
// want to measure it in Message to see if it's correct
messageStyle.height = item.contentHeight;
}

const rules = useTextMessageMarkdownRules(darkColor);
const textMessageMarkdown = useTextMessageMarkdown(item.messageInfo);

Expand Down

0 comments on commit 14a2d48

Please sign in to comment.