@@ -3,36 +3,25 @@ import { StyleSheet } from 'react-native';
33
44import Animated , { ZoomIn , ZoomOut } from 'react-native-reanimated' ;
55
6- import { AttachmentManagerState } from 'stream-chat' ;
7-
86import { textComposerStateSelector } from './utils/messageComposerSelectors' ;
97
108import { useMessageComposer } from '../../contexts/messageInputContext/hooks/useMessageComposer' ;
119import { useStateStore } from '../../hooks/useStateStore' ;
1210import { primitives } from '../../theme' ;
1311import { GiphyChip } from '../ui/GiphyChip' ;
1412
15- const hasAttachmentsSelector = ( nextState : AttachmentManagerState ) => ( {
16- hasAttachments : nextState . attachments ?. length > 0 ,
17- } ) ;
18-
1913export const MessageInputLeadingView = ( ) => {
2014 const messageComposer = useMessageComposer ( ) ;
21- const { textComposer } = messageComposer ;
22- // TODO: V9: This needs to come from the LLC.
23- const { hasAttachments } = useStateStore (
24- messageComposer . attachmentManager . state ,
25- hasAttachmentsSelector ,
26- ) ;
15+ const { textComposer, attachmentManager } = messageComposer ;
2716 const { command } = useStateStore ( textComposer . state , textComposerStateSelector ) ;
2817
2918 useEffect ( ( ) => {
30- if ( hasAttachments ) {
19+ if ( attachmentManager . state . getLatestValue ( ) . attachments . length > 0 ) {
3120 textComposer . clearCommand ( ) ;
3221 }
33- } , [ textComposer , hasAttachments ] ) ;
22+ } , [ textComposer , attachmentManager ] ) ;
3423
35- return command && ! hasAttachments ? (
24+ return command ? (
3625 < Animated . View
3726 entering = { ZoomIn . duration ( 200 ) }
3827 exiting = { ZoomOut . duration ( 200 ) }
0 commit comments