@@ -125,7 +125,7 @@ class UploadButton extends React.Component<IUploadButtonProps> {
125
125
private uploadInput = React . createRef < HTMLInputElement > ( ) ;
126
126
private dispatcherRef : string ;
127
127
128
- constructor ( props ) {
128
+ constructor ( props : IUploadButtonProps ) {
129
129
super ( props ) ;
130
130
131
131
this . dispatcherRef = dis . register ( this . onAction ) ;
@@ -275,7 +275,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
275
275
compact : false ,
276
276
} ;
277
277
278
- constructor ( props ) {
278
+ constructor ( props : IProps ) {
279
279
super ( props ) ;
280
280
VoiceRecordingStore . instance . on ( UPDATE_EVENT , this . onVoiceStoreUpdate ) ;
281
281
@@ -499,10 +499,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
499
499
}
500
500
} ;
501
501
502
- private shouldShowStickerPicker = ( ) : boolean => {
503
- return this . state . showStickersButton && ! this . state . haveRecording ;
504
- } ;
505
-
506
502
private showStickers = ( showStickers : boolean ) => {
507
503
this . setState ( { showStickers } ) ;
508
504
} ;
@@ -513,41 +509,43 @@ export default class MessageComposer extends React.Component<IProps, IState> {
513
509
} ) ;
514
510
} ;
515
511
516
- private renderButtons ( menuPosition ) : JSX . Element | JSX . Element [ ] {
512
+ private renderButtons ( menuPosition : AboveLeftOf ) : JSX . Element | JSX . Element [ ] {
513
+ if ( this . state . haveRecording ) {
514
+ return [ ] ;
515
+ }
516
+
517
517
let uploadButtonIndex = 0 ;
518
518
const buttons : JSX . Element [ ] = [ ] ;
519
- if ( ! this . state . haveRecording ) {
519
+ buttons . push (
520
+ < PollButton
521
+ key = "polls"
522
+ room = { this . props . room }
523
+ narrowMode = { this . state . narrowMode }
524
+ /> ,
525
+ ) ;
526
+ uploadButtonIndex = buttons . length ;
527
+ buttons . push (
528
+ < UploadButton key = "controls_upload" roomId = { this . props . room . roomId } relation = { this . props . relation } /> ,
529
+ ) ;
530
+ if ( this . state . showLocationButton ) {
531
+ const sender = this . props . room . getMember (
532
+ MatrixClientPeg . get ( ) . getUserId ( ) ,
533
+ ) ;
520
534
buttons . push (
521
- < PollButton
522
- key = "polls"
523
- room = { this . props . room }
535
+ < LocationButton
536
+ key = "location"
537
+ roomId = { this . props . room . roomId }
538
+ sender = { sender }
539
+ menuPosition = { menuPosition }
524
540
narrowMode = { this . state . narrowMode }
525
541
/> ,
526
542
) ;
527
- uploadButtonIndex = buttons . length ;
528
- buttons . push (
529
- < UploadButton key = "controls_upload" roomId = { this . props . room . roomId } relation = { this . props . relation } /> ,
530
- ) ;
531
- if ( this . state . showLocationButton ) {
532
- const sender = this . props . room . getMember (
533
- MatrixClientPeg . get ( ) . getUserId ( ) ,
534
- ) ;
535
- buttons . push (
536
- < LocationButton
537
- key = "location"
538
- roomId = { this . props . room . roomId }
539
- sender = { sender }
540
- menuPosition = { menuPosition }
541
- narrowMode = { this . state . narrowMode }
542
- /> ,
543
- ) ;
544
- }
545
- buttons . push (
546
- < EmojiButton key = "emoji_button" addEmoji = { this . addEmoji } menuPosition = { menuPosition } narrowMode = { this . state . narrowMode } /> ,
547
- ) ;
548
543
}
549
- if ( this . shouldShowStickerPicker ( ) ) {
550
- let title ;
544
+ buttons . push (
545
+ < EmojiButton key = "emoji_button" addEmoji = { this . addEmoji } menuPosition = { menuPosition } narrowMode = { this . state . narrowMode } /> ,
546
+ ) ;
547
+ if ( this . state . showStickersButton ) {
548
+ let title : string ;
551
549
if ( ! this . state . narrowMode ) {
552
550
title = this . state . showStickers ? _t ( "Hide Stickers" ) : _t ( "Show Stickers" ) ;
553
551
}
@@ -565,7 +563,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
565
563
}
566
564
567
565
// XXX: the recording UI does not work well in narrow mode, so we hide this button for now
568
- if ( ! this . state . haveRecording && ! this . state . narrowMode ) {
566
+ if ( ! this . state . narrowMode ) {
569
567
buttons . push (
570
568
< CollapsibleButton
571
569
key = "voice_message_send"
0 commit comments