@@ -199,10 +199,6 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
199
199
200
200
const inputBlurTimeoutId = useRef < ?TimeoutID > ( null ) ;
201
201
202
- // TODO(#5141): Encapsulate this in a nice, plain action-sheet pattern
203
- // instead of setting it all over the place
204
- const [ isMenuExpanded , setIsMenuExpanded ] = useState < boolean > ( false ) ;
205
-
206
202
const [ height , setHeight ] = useState < number > ( 20 ) ;
207
203
208
204
const [ focusState , setFocusState ] = useState < { |
@@ -258,20 +254,9 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
258
254
if ( ! isEditing ) {
259
255
dispatch ( draftUpdate ( narrow , messageInputValue ) ) ;
260
256
}
261
- setIsMenuExpanded ( false ) ;
262
257
}
263
258
} , [ dispatch , isEditing , narrow , messageInputState , prevMessageInputState ] ) ;
264
259
265
- const prevTopicInputState = usePrevious ( topicInputState ) ;
266
- useEffect ( ( ) => {
267
- const topicInputValue = topicInputState . value ;
268
- const prevTopicInputValue = prevTopicInputState ?. value ;
269
-
270
- if ( prevTopicInputValue !== topicInputValue ) {
271
- setIsMenuExpanded ( false ) ;
272
- }
273
- } , [ topicInputState , prevTopicInputState ] ) ;
274
-
275
260
const updateIsFocused = useCallback ( ( ) => {
276
261
setFocusState ( state => ( { ...state , either : state . message || state . topic } ) ) ;
277
262
} , [ ] ) ;
@@ -454,10 +439,6 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
454
439
) ;
455
440
useImperativeHandle ( ref , ( ) => ( { doQuoteAndReply } ) , [ doQuoteAndReply ] ) ;
456
441
457
- const handleComposeMenuToggle = useCallback ( ( ) => {
458
- setIsMenuExpanded ( x => ! x ) ;
459
- } , [ ] ) ;
460
-
461
442
const handleLayoutChange = useCallback ( ( event : LayoutEvent ) => {
462
443
setHeight ( event . nativeEvent . layout . height ) ;
463
444
} , [ ] ) ;
@@ -495,13 +476,11 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
495
476
topicInputRef . current ?. focus ( ) ;
496
477
} else {
497
478
setFocusState ( state => ( { ...state , message : true , either : true } ) ) ;
498
- setIsMenuExpanded ( false ) ;
499
479
}
500
480
} , [ isEditing , narrow , focusState . either , topicInputState . value , topicInputRef ] ) ;
501
481
502
482
const handleMessageBlur = useCallback ( ( ) => {
503
483
setFocusState ( state => ( { ...state , message : false } ) ) ;
504
- setIsMenuExpanded ( false ) ;
505
484
dispatch ( sendTypingStop ( narrow ) ) ;
506
485
// give a chance to the topic input to get the focus
507
486
clearTimeout ( inputBlurTimeoutId . current ) ;
@@ -510,21 +489,15 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
510
489
511
490
const handleTopicFocus = useCallback ( ( ) => {
512
491
setFocusState ( state => ( { ...state , topic : true , either : true } ) ) ;
513
- setIsMenuExpanded ( false ) ;
514
492
} , [ ] ) ;
515
493
516
494
const handleTopicBlur = useCallback ( ( ) => {
517
495
setFocusState ( state => ( { ...state , topic : false } ) ) ;
518
- setIsMenuExpanded ( false ) ;
519
496
// give a chance to the message input to get the focus
520
497
clearTimeout ( inputBlurTimeoutId . current ) ;
521
498
inputBlurTimeoutId . current = setTimeout ( updateIsFocused , FOCUS_DEBOUNCE_TIME_MS ) ;
522
499
} , [ updateIsFocused ] ) ;
523
500
524
- const handleInputTouchStart = useCallback ( ( ) => {
525
- setIsMenuExpanded ( false ) ;
526
- } , [ ] ) ;
527
-
528
501
const destinationNarrow = useMemo ( ( ) => {
529
502
if ( isStreamNarrow ( narrow ) || ( isTopicNarrow ( narrow ) && isEditing ) ) {
530
503
const streamId = streamIdOfNarrow ( narrow ) ;
@@ -652,7 +625,8 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
652
625
} ,
653
626
composeInputs : {
654
627
flex : 1 ,
655
- paddingVertical : 8 ,
628
+ paddingTop : 8 ,
629
+ paddingLeft : 8 ,
656
630
} ,
657
631
submitButtonContainer : {
658
632
padding : 8 ,
@@ -739,15 +713,6 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
739
713
style = { styles . composeBox }
740
714
onLayout = { handleLayoutChange }
741
715
>
742
- < ComposeMenu
743
- destinationNarrow = { destinationNarrow }
744
- expanded = { isMenuExpanded }
745
- insertAttachment = { insertAttachment }
746
- insertVideoCallLink = {
747
- videoChatProvider !== null ? ( ) => insertVideoCallLink ( videoChatProvider ) : null
748
- }
749
- onExpandContract = { handleComposeMenuToggle }
750
- />
751
716
< View style = { styles . composeInputs } >
752
717
< Input
753
718
style = { styles . topicInput }
@@ -761,14 +726,12 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
761
726
{ ...topicInputCallbacks }
762
727
onFocus = { handleTopicFocus }
763
728
onBlur = { handleTopicBlur }
764
- onTouchStart = { handleInputTouchStart }
765
729
onSubmitEditing = { ( ) => messageInputRef . current ?. focus ( ) }
766
730
blurOnSubmit = { false }
767
731
returnKeyType = "next"
768
732
/>
769
733
< Input
770
- // TODO(#5291): Don't switch between true/false for multiline
771
- multiline = { ! isMenuExpanded }
734
+ multiline
772
735
style = { styles . composeTextInput }
773
736
underlineColorAndroid = "transparent"
774
737
placeholder = { placeholder }
@@ -778,7 +741,13 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
778
741
{ ...messageInputCallbacks }
779
742
onBlur = { handleMessageBlur }
780
743
onFocus = { handleMessageFocus }
781
- onTouchStart = { handleInputTouchStart }
744
+ />
745
+ < ComposeMenu
746
+ destinationNarrow = { destinationNarrow }
747
+ insertAttachment = { insertAttachment }
748
+ insertVideoCallLink = {
749
+ videoChatProvider !== null ? ( ) => insertVideoCallLink ( videoChatProvider ) : null
750
+ }
782
751
/>
783
752
</ View >
784
753
< View style = { styles . submitButtonContainer } >
0 commit comments