Only rendering the emoji picker when it's needed

If not done so the whole channel select render will take an eternity
This commit is contained in:
WolverinDEV 2021-01-06 17:26:34 +01:00
parent 4d9df41c35
commit b17fb5dea8

View file

@ -59,21 +59,24 @@ const EmojiButton = (props: { events: Registry<ChatBoxEvents> }) => {
<img alt={""} src={"img/smiley-smile.svg"} /> <img alt={""} src={"img/smiley-smile.svg"} />
</div> </div>
<div className={cssStyle.picker} style={{ display: shown ? undefined : "none" }}> <div className={cssStyle.picker} style={{ display: shown ? undefined : "none" }}>
<Picker {!shown ? undefined :
set={"twitter"} <Picker
theme={"light"} key={"picker"}
showPreview={true} set={"twitter"}
title={""} theme={"light"}
showSkinTones={true} showPreview={true}
useButton={false} title={""}
native={false} showSkinTones={true}
useButton={false}
native={false}
onSelect={(emoji: any) => { onSelect={(emoji: any) => {
if(enabled) { if(enabled) {
props.events.fire("action_insert_text", { text: emoji.native, focus: true }); props.events.fire("action_insert_text", { text: emoji.native, focus: true });
} }
}} }}
/> />
}
</div> </div>
</div> </div>
); );