@@ -56,11 +56,13 @@ import {
5656import { useAttachmentPickerState } from '../../hooks/useAttachmentPickerState' ;
5757import { useKeyboardVisibility } from '../../hooks/useKeyboardVisibility' ;
5858import { useStateStore } from '../../hooks/useStateStore' ;
59+ import { setOverlayComposerH } from '../../state-store' ;
5960import { AudioRecorderManagerState } from '../../state-store/audio-recorder-manager' ;
6061import { MessageInputHeightState } from '../../state-store/message-input-height-store' ;
6162import { primitives } from '../../theme' ;
6263import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput' ;
6364import { CreatePoll } from '../Poll/CreatePollContent' ;
65+ import { PortalWhileClosingView } from '../UIComponents/PortalWhileClosingView' ;
6466import { SafeAreaViewWrapper } from '../UIComponents/SafeAreaViewWrapper' ;
6567
6668const useStyles = ( ) => {
@@ -356,117 +358,124 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
356358 ( ) => ( { micPositionX, micPositionY } ) ,
357359 [ micPositionX , micPositionY ] ,
358360 ) ;
359-
360361 return (
361362 < MicPositionProvider value = { micPositionContextValue } >
362- { /* TODO V9: Think of a better way to do this without so much re-layouting. */ }
363- < Animated . View
364- layout = { LinearTransition . duration ( 200 ) }
365- onLayout = { ( {
366- nativeEvent : {
367- layout : { height : newHeight } ,
368- } ,
369- } ) =>
370- messageInputHeightStore . setHeight (
371- messageInputFloating ? newHeight + BOTTOM_OFFSET : newHeight ,
372- )
373- } // BOTTOM OFFSET is the position of the input from the bottom of the screen
374- style = {
375- messageInputFloating
376- ? [ styles . wrapper , styles . floatingWrapper , { bottom : BOTTOM_OFFSET } , floatingWrapper ]
377- : [
378- styles . wrapper ,
379- {
380- borderTopWidth : 1 ,
381- backgroundColor : semantics . composerBg ,
382- borderColor : semantics . borderCoreDefault ,
383- // paddingBottom: BOTTOM_OFFSET,
384- paddingBottom :
385- selectedPicker && ! isKeyboardVisible
386- ? attachmentPickerBottomSheetHeight - bottomInset + BOTTOM_OFFSET
387- : BOTTOM_OFFSET ,
388- } ,
389- wrapper ,
390- ]
391- }
392- >
393- { Input ? (
394- < Input additionalTextInputProps = { additionalTextInputProps } getUsers = { getUsers } />
395- ) : (
396- < View style = { [ styles . container , container ] } >
397- < MessageComposerLeadingView />
398- < Animated . View
399- layout = { LinearTransition . duration ( 200 ) }
400- style = { [
401- styles . inputBoxWrapper ,
402- messageInputFloating ? [ styles . shadow , inputFloatingContainer ] : null ,
403- inputBoxWrapper ,
404- isFocused ? focusedInputBoxContainer : null ,
405- ] }
406- >
407- < View style = { [ styles . inputBoxContainer , inputBoxContainer ] } >
408- { recordingStatus === 'stopped' ? (
409- < AudioRecordingPreview />
410- ) : micLocked ? (
411- < AudioRecordingInProgress />
412- ) : null }
413-
414- < MessageInputHeaderView />
415-
363+ < Animated . View layout = { LinearTransition . duration ( 200 ) } >
364+ < PortalWhileClosingView
365+ placeholderHeight = { height }
366+ portalHostName = 'overlay-composer'
367+ portalName = 'message-input-composer'
368+ >
369+ < View
370+ onLayout = { ( {
371+ nativeEvent : {
372+ layout : { height : newHeight } ,
373+ } ,
374+ } ) => {
375+ setOverlayComposerH ( newHeight ) ;
376+ messageInputHeightStore . setHeight (
377+ messageInputFloating ? newHeight + BOTTOM_OFFSET : newHeight ,
378+ ) ;
379+ } }
380+ style = {
381+ messageInputFloating
382+ ? [ styles . wrapper , styles . floatingWrapper , { bottom : BOTTOM_OFFSET } , floatingWrapper ]
383+ : [
384+ styles . wrapper ,
385+ {
386+ borderTopWidth : 1 ,
387+ backgroundColor : semantics . composerBg ,
388+ borderColor : semantics . borderCoreDefault ,
389+ // paddingBottom: BOTTOM_OFFSET,
390+ paddingBottom :
391+ selectedPicker && ! isKeyboardVisible
392+ ? attachmentPickerBottomSheetHeight - bottomInset + BOTTOM_OFFSET
393+ : BOTTOM_OFFSET ,
394+ } ,
395+ wrapper ,
396+ ]
397+ }
398+ >
399+ { Input ? (
400+ < Input additionalTextInputProps = { additionalTextInputProps } getUsers = { getUsers } />
401+ ) : (
402+ < View style = { [ styles . container , container ] } >
403+ < MessageComposerLeadingView />
416404 < Animated . View
417- style = { [ styles . inputContainer , inputContainer ] }
418405 layout = { LinearTransition . duration ( 200 ) }
406+ style = { [
407+ styles . inputBoxWrapper ,
408+ messageInputFloating ? [ styles . shadow , inputFloatingContainer ] : null ,
409+ inputBoxWrapper ,
410+ isFocused ? focusedInputBoxContainer : null ,
411+ ] }
419412 >
420- { ! isRecordingStateIdle ? (
421- < AudioRecorder slideToCancelStyle = { slideToCancelAnimatedStyle } />
422- ) : (
423- < >
424- < MessageInputLeadingView />
425-
426- < Animated . View
427- style = { styles . autocompleteInputContainer }
428- layout = { LinearTransition . duration ( 200 ) }
429- >
430- < AutoCompleteInput
431- TextInputComponent = { TextInputComponent }
432- { ...additionalTextInputProps }
433- />
434- </ Animated . View >
435- </ >
436- ) }
437-
438- < MessageInputTrailingView />
413+ < View style = { [ styles . inputBoxContainer , inputBoxContainer ] } >
414+ { recordingStatus === 'stopped' ? (
415+ < AudioRecordingPreview />
416+ ) : micLocked ? (
417+ < AudioRecordingInProgress />
418+ ) : null }
419+
420+ < MessageInputHeaderView />
421+
422+ < Animated . View
423+ style = { [ styles . inputContainer , inputContainer ] }
424+ layout = { LinearTransition . duration ( 200 ) }
425+ >
426+ { ! isRecordingStateIdle ? (
427+ < AudioRecorder slideToCancelStyle = { slideToCancelAnimatedStyle } />
428+ ) : (
429+ < >
430+ < MessageInputLeadingView />
431+
432+ < Animated . View
433+ style = { styles . autocompleteInputContainer }
434+ layout = { LinearTransition . duration ( 200 ) }
435+ >
436+ < AutoCompleteInput
437+ TextInputComponent = { TextInputComponent }
438+ { ...additionalTextInputProps }
439+ />
440+ </ Animated . View >
441+ </ >
442+ ) }
443+
444+ < MessageInputTrailingView />
445+ </ Animated . View >
446+ </ View >
439447 </ Animated . View >
440448 </ View >
441- </ Animated . View >
449+ ) }
450+ < ShowThreadMessageInChannelButton threadList = { threadList } />
451+ { ! isRecordingStateIdle ? (
452+ < View
453+ style = { [
454+ styles . audioLockIndicatorWrapper ,
455+ {
456+ bottom : messageInputFloating ? 0 : 16 ,
457+ } ,
458+ ] }
459+ >
460+ < AudioRecordingLockIndicator
461+ messageInputHeight = { height }
462+ micLocked = { micLocked }
463+ style = { lockIndicatorAnimatedStyle }
464+ />
465+ </ View >
466+ ) : (
467+ < MessageComposerTrailingView />
468+ ) }
469+
470+ < View
471+ style = { [ styles . suggestionsListContainer , { bottom : height } , suggestionListContainer ] }
472+ >
473+ < AutoCompleteSuggestionList />
474+ </ View >
442475 </ View >
443- ) }
444- < ShowThreadMessageInChannelButton threadList = { threadList } />
476+ </ PortalWhileClosingView >
445477 </ Animated . View >
446478
447- { ! isRecordingStateIdle ? (
448- < View
449- style = { [
450- styles . audioLockIndicatorWrapper ,
451- {
452- bottom : messageInputFloating ? 0 : 16 ,
453- } ,
454- ] }
455- >
456- < AudioRecordingLockIndicator
457- messageInputHeight = { height }
458- micLocked = { micLocked }
459- style = { lockIndicatorAnimatedStyle }
460- />
461- </ View >
462- ) : (
463- < MessageComposerTrailingView />
464- ) }
465-
466- < View style = { [ styles . suggestionsListContainer , { bottom : height } , suggestionListContainer ] } >
467- < AutoCompleteSuggestionList />
468- </ View >
469-
470479 { showPollCreationDialog ? (
471480 < View style = { styles . pollModalWrapper } >
472481 < Modal
0 commit comments