From d88f1ac68ca1c1e037654cfabe91d68171f2facb Mon Sep 17 00:00:00 2001 From: lk8888 <1119240633@qq.com> Date: Fri, 15 Mar 2024 23:35:09 +0800 Subject: [PATCH] Fix the bug of slow emoji rendering on mac chrome --- .../emoji-mart/src/components/Picker/Picker.tsx | 8 +++++++- packages/emoji-mart/src/helpers/index.ts | 1 + packages/emoji-mart/src/helpers/user-agent.ts | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 packages/emoji-mart/src/helpers/user-agent.ts diff --git a/packages/emoji-mart/src/components/Picker/Picker.tsx b/packages/emoji-mart/src/components/Picker/Picker.tsx index 24cad2e62..ec516b136 100644 --- a/packages/emoji-mart/src/components/Picker/Picker.tsx +++ b/packages/emoji-mart/src/components/Picker/Picker.tsx @@ -3,7 +3,7 @@ import { Component, createRef } from 'preact' import { deepEqual, sleep, getEmojiData } from '../../utils' import { Data, I18n, init } from '../../config' -import { SearchIndex, Store, FrequentlyUsed } from '../../helpers' +import { SearchIndex, Store, FrequentlyUsed, UserAgent } from '../../helpers' import Icons from '../../icons' import { Emoji } from '../Emoji' @@ -776,6 +776,12 @@ export default class Picker extends Component { height: this.props.emojiButtonSize, fontSize: this.props.emojiSize, lineHeight: 0, + backfaceVisibility: + UserAgent.isMacOs && + UserAgent.chromeVersion > 0 && + UserAgent.chromeVersion < 121 + ? 'hidden' + : undefined, }} >
-1 +const chromeVersion: number = isChrome + ? parseInt(agent.match(/chrome\/(\d+)/i)[1]) + : 0 + +export default { + isMacOs, + isChrome, + chromeVersion, +}