Fix runtime react errors for various parts of the app

These are just the ones that were causing console flooding on reload in development.

* Elements in a list need a `key`
* `super()` needs to be supplied with the same props as the parent
* `<div>` (AccessibleButton) cannot be a descendant of `<p>` - this was a problem in the NewRoomIntro "Add topic" button
* `label` is a non-boolean property and cannot receive "false"
This commit is contained in:
Travis Ralston 2021-10-18 13:47:42 -06:00
parent 98ba3fd6e6
commit dad1d3f131
4 changed files with 23 additions and 7 deletions

View file

@ -116,7 +116,7 @@ const EmojiButton: React.FC<IEmojiButtonProps> = ({ addEmoji, menuPosition, narr
className={className}
onClick={openMenu}
title={!narrowMode && _t('Emoji picker')}
label={narrowMode && _t("Add emoji")}
label={(narrowMode && _t("Add emoji")) || null}
/>
{ contextMenu }
@ -485,13 +485,14 @@ export default class MessageComposer extends React.Component<IProps, IState> {
className="mx_MessageComposer_button mx_MessageComposer_stickers"
onClick={() => this.showStickers(!this.state.showStickers)}
title={title}
label={this.state.narrowMode && _t("Send a sticker")}
label={(this.state.narrowMode && _t("Send a sticker")) || null}
/>,
);
}
if (!this.state.haveRecording && !this.state.narrowMode) {
buttons.push(
<AccessibleTooltipButton
key="voice_message_send"
className="mx_MessageComposer_button mx_MessageComposer_voiceMessage"
onClick={() => this.voiceRecordingButton.current?.onRecordStartEndClick()}
title={_t("Send voice message")}
@ -615,7 +616,9 @@ export default class MessageComposer extends React.Component<IProps, IState> {
room={this.props.room}
showStickers={this.state.showStickers}
setShowStickers={this.showStickers}
menuPosition={menuPosition} />,
menuPosition={menuPosition}
key="stickers"
/>,
);
const showSendButton = !this.state.isComposerEmpty || this.state.haveRecording;