Skip to content

Commit

Permalink
Merge pull request Expensify#18523 from Ollyws/fix2-15194
Browse files Browse the repository at this point in the history
Fix for: Triple clicking an edited message select’s the (edited) label along with the actual message Att# 2
  • Loading branch information
marcochavezf authored May 19, 2023
2 parents 2182d0c + dd8c5b4 commit 8a3d79c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import withLocalize, {withLocalizePropTypes} from '../../withLocalize';
import Text from '../../Text';
import variables from '../../../styles/variables';
import themeColors from '../../../styles/themes/default';
import styles from '../../../styles/styles';
import editedLabelStyles from '../../../styles/editedLabelStyles';

const propTypes = {
...htmlRendererPropTypes,
Expand All @@ -19,8 +21,16 @@ const EditedRenderer = (props) => {
{...defaultRendererProps}
fontSize={variables.fontSizeSmall}
color={themeColors.textSupporting}
style={[styles.alignItemsBaseline, editedLabelStyles]}
>
{` ${props.translate('reportActionCompose.edited')}`}
{/* Native devices do not support margin between nested text */}
<Text
selectable={false}
style={[styles.w1, styles.userSelectNone]}
>
{' '}
</Text>
{props.translate('reportActionCompose.edited')}
</Text>
);
};
Expand Down
19 changes: 9 additions & 10 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,15 @@ class ReportActionItem extends Component {
{(hovered) => (
<View accessibilityLabel={this.props.translate('accessibilityHints.chatMessage')}>
{this.props.shouldDisplayNewMarker && <UnreadActionIndicator reportActionID={this.props.action.reportActionID} />}
<MiniReportActionContextMenu
reportID={this.props.report.reportID}
reportAction={this.props.action}
isArchivedRoom={ReportUtils.isArchivedRoom(this.props.report)}
displayAsGroup={this.props.displayAsGroup}
isVisible={hovered && !this.props.draftMessage && !hasErrors}
draftMessage={this.props.draftMessage}
isChronosReport={ReportUtils.chatIncludesChronos(this.props.report)}
/>
<View
style={StyleUtils.getReportActionItemStyle(
hovered || isWhisper || this.state.isContextMenuActive || this.props.draftMessage,
Expand Down Expand Up @@ -421,16 +430,6 @@ class ReportActionItem extends Component {
{this.renderReportActionItem(hovered, isWhisper)}
</OfflineWithFeedback>
</View>
<MiniReportActionContextMenu
reportID={this.props.report.reportID}
reportAction={this.props.action}
isArchivedRoom={ReportUtils.isArchivedRoom(this.props.report)}
displayAsGroup={this.props.displayAsGroup}
isVisible={hovered && !this.props.draftMessage && !hasErrors}
draftMessage={this.props.draftMessage}
isChronosReport={ReportUtils.chatIncludesChronos(this.props.report)}
childReportActionID={this.props.action.childReportActionID}
/>
</View>
)}
</Hoverable>
Expand Down
10 changes: 9 additions & 1 deletion src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import convertToLTR from '../../../libs/convertToLTR';
import {withNetwork} from '../../../components/OnyxProvider';
import CONST from '../../../CONST';
import applyStrikethrough from '../../../components/HTMLEngineProvider/applyStrikethrough';
import editedLabelStyles from '../../../styles/editedLabelStyles';

const propTypes = {
/** The message fragment needing to be displayed */
Expand Down Expand Up @@ -124,8 +125,15 @@ const ReportActionItemFragment = (props) => {
<Text
fontSize={variables.fontSizeSmall}
color={themeColors.textSupporting}
style={[styles.alignItemsBaseline, editedLabelStyles]}
>
{` ${props.translate('reportActionCompose.edited')}`}
<Text
selectable={false}
style={[styles.w1, styles.userSelectNone]}
>
{' '}
</Text>
{props.translate('reportActionCompose.edited')}
</Text>
)}
</Text>
Expand Down
3 changes: 3 additions & 0 deletions src/styles/editedLabelStyles/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import display from '../utilities/display';

export default {...display.dInlineFlex};
1 change: 1 addition & 0 deletions src/styles/editedLabelStyles/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
5 changes: 5 additions & 0 deletions src/styles/utilities/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export default {
dInline: {
display: 'inline',
},

dInlineFlex: {
display: 'inline-flex',
},

dBlock: {
display: 'block',
},
Expand Down

0 comments on commit 8a3d79c

Please sign in to comment.