Skip to content

Commit

Permalink
Merge pull request #37778 from Expensify/revert-35838-fix/34307
Browse files Browse the repository at this point in the history
Revert "Handle emoji tooltip"
  • Loading branch information
roryabraham authored Mar 5, 2024
2 parents 245a4a5 + 47210ea commit e1944e6
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 120 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#45d3b61bb38b4f9a19ddf573ce1e212369b242db",
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#a8ed0f8e1be3a1e09016e07a74cfd13c85bbc167",
"expo": "^50.0.3",
"expo-av": "~13.10.4",
"expo-image": "1.10.1",
Expand Down
10 changes: 0 additions & 10 deletions src/components/EmojiWithTooltip/index.native.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions src/components/EmojiWithTooltip/index.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions src/components/EmojiWithTooltip/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
mixedUAStyles: {whiteSpace: 'pre'},
contentModel: HTMLContentModel.block,
}),
emoji: HTMLElementModel.fromCustomModel({tagName: 'emoji', contentModel: HTMLContentModel.textual}),
}),
[styles.colorMuted, styles.formError, styles.mb0, styles.textLabelSupporting, styles.lh16],
);
Expand Down
19 changes: 0 additions & 19 deletions src/components/HTMLEngineProvider/HTMLRenderers/EmojiRenderer.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/HTMLEngineProvider/HTMLRenderers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {CustomTagRendererRecord} from 'react-native-render-html';
import AnchorRenderer from './AnchorRenderer';
import CodeRenderer from './CodeRenderer';
import EditedRenderer from './EditedRenderer';
import EmojiRenderer from './EmojiRenderer';
import ImageRenderer from './ImageRenderer';
import MentionHereRenderer from './MentionHereRenderer';
import MentionUserRenderer from './MentionUserRenderer';
Expand All @@ -26,7 +25,6 @@ const HTMLEngineProviderComponentList: CustomTagRendererRecord = {
/* eslint-disable @typescript-eslint/naming-convention */
'mention-user': MentionUserRenderer,
'mention-here': MentionHereRenderer,
emoji: EmojiRenderer,
'next-step-email': NextStepEmailRenderer,
/* eslint-enable @typescript-eslint/naming-convention */
};
Expand Down
3 changes: 0 additions & 3 deletions src/libs/EmojiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ const findEmojiByName = (name: string): Emoji => Emojis.emojiNameTable[name];
const findEmojiByCode = (code: string): Emoji => Emojis.emojiCodeTableWithSkinTones[code];

const getEmojiName = (emoji: Emoji, lang: 'en' | 'es' = CONST.LOCALES.DEFAULT): string => {
if (!emoji) {
return '';
}
if (lang === CONST.LOCALES.DEFAULT) {
return emoji.name;
}
Expand Down
18 changes: 9 additions & 9 deletions src/pages/home/report/comment/TextCommentFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import CONST from '@src/CONST';
import type {OriginalMessageSource} from '@src/types/onyx/OriginalMessage';
import type {Message} from '@src/types/onyx/ReportAction';
import RenderCommentHTML from './RenderCommentHTML';
import shouldRenderAsText from './shouldRenderAsText';

type TextCommentFragmentProps = {
/** The reportAction's source */
Expand Down Expand Up @@ -45,15 +44,15 @@ function TextCommentFragment({fragment, styleAsDeleted, source, style, displayAs
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();

// If the only difference between fragment.text and fragment.html is <br /> tags and emoji tag
// on native, we render it as text, not as html
// on other device, only render it as text if the only difference is <br /> tag
const containsOnlyEmojis = EmojiUtils.containsOnlyEmojis(text);
if (!shouldRenderAsText(html, text) && !(containsOnlyEmojis && styleAsDeleted)) {
const editedTag = fragment.isEdited ? `<edited ${styleAsDeleted ? 'deleted' : ''}></edited>` : '';
const htmlWithDeletedTag = styleAsDeleted ? `<del>${html}</del>` : html;
// If the only difference between fragment.text and fragment.html is <br /> tags
// we render it as text, not as html.
// This is done to render emojis with line breaks between them as text.
const differByLineBreaksOnly = Str.replaceAll(html, '<br />', '\n') === text;

const htmlContent = containsOnlyEmojis ? Str.replaceAll(htmlWithDeletedTag, '<emoji>', '<emoji islarge>') : htmlWithDeletedTag;
// Only render HTML if we have html in the fragment
if (!differByLineBreaksOnly) {
const editedTag = fragment.isEdited ? `<edited ${styleAsDeleted ? 'deleted' : ''}></edited>` : '';
const htmlContent = styleAsDeleted ? `<del>${html}</del>` : html;

const htmlWithTag = editedTag ? `${htmlContent}${editedTag}` : htmlContent;

Expand All @@ -65,6 +64,7 @@ function TextCommentFragment({fragment, styleAsDeleted, source, style, displayAs
);
}

const containsOnlyEmojis = EmojiUtils.containsOnlyEmojis(text);
const message = isEmpty(iouMessage) ? text : iouMessage;

return (
Expand Down
12 changes: 0 additions & 12 deletions src/pages/home/report/comment/shouldRenderAsText/index.native.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/pages/home/report/comment/shouldRenderAsText/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,6 @@ const styles = (theme: ThemeColors) =>
...wordBreak.breakWord,
...spacing.pr4,
},
emojiTooltipWrapper: {
...spacing.p2,
borderRadius: 8,
},

mentionSuggestionsAvatarContainer: {
width: 24,
Expand Down

0 comments on commit e1944e6

Please sign in to comment.