Temp EmojiBoard performance improved

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-12-30 16:37:11 +05:30
parent 34862f9ace
commit 0b43431543

View file

@ -29,7 +29,7 @@ import BulbIC from '../../../../public/res/ic/outlined/bulb.svg';
import PeaceIC from '../../../../public/res/ic/outlined/peace.svg'; import PeaceIC from '../../../../public/res/ic/outlined/peace.svg';
import FlagIC from '../../../../public/res/ic/outlined/flag.svg'; import FlagIC from '../../../../public/res/ic/outlined/flag.svg';
function EmojiGroup({ name, groupEmojis }) { const EmojiGroup = React.memo(({ name, groupEmojis }) => {
function getEmojiBoard() { function getEmojiBoard() {
const emojiBoard = []; const emojiBoard = [];
const ROW_EMOJIS_COUNT = 7; const ROW_EMOJIS_COUNT = 7;
@ -64,7 +64,7 @@ function EmojiGroup({ name, groupEmojis }) {
alt={emoji.shortcode} alt={emoji.shortcode}
unicode={`:${emoji.shortcode}:`} unicode={`:${emoji.shortcode}:`}
shortcodes={emoji.shortcode} shortcodes={emoji.shortcode}
src={initMatrix.matrixClient.mxcUrlToHttp(emoji.mxc, 38, 38, 'crop')} src={initMatrix.matrixClient.mxcUrlToHttp(emoji.mxc)}
data-mx-emoticon data-mx-emoticon
/> />
) )
@ -83,7 +83,8 @@ function EmojiGroup({ name, groupEmojis }) {
{groupEmojis.length !== 0 && <div className="emoji-set">{getEmojiBoard()}</div>} {groupEmojis.length !== 0 && <div className="emoji-set">{getEmojiBoard()}</div>}
</div> </div>
); );
} });
EmojiGroup.propTypes = { EmojiGroup.propTypes = {
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
groupEmojis: PropTypes.arrayOf(PropTypes.shape({ groupEmojis: PropTypes.arrayOf(PropTypes.shape({