File tree Expand file tree Collapse file tree 6 files changed +21
-2
lines changed Expand file tree Collapse file tree 6 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ import {
99 MessageResponse ,
1010 SendMessageAPIResponse ,
1111 StreamChat ,
12+ Event as StreamEvent ,
1213 Message as StreamMessage ,
1314} from 'stream-chat' ;
1415
16+ import { useAppStateListener } from '../../hooks/useAppStateListener' ;
1517import { useCreateChannelContext } from './hooks/useCreateChannelContext' ;
1618import { useCreateInputMessageInputContext } from './hooks/useCreateInputMessageInputContext' ;
1719import { useCreateMessagesContext } from './hooks/useCreateMessagesContext' ;
@@ -608,6 +610,22 @@ const ChannelWithContext = <
608610 }
609611 } , [ threadPropsExists ] ) ;
610612
613+ const handleAppBackground = useCallback ( ( ) => {
614+ if ( channel ) {
615+ channel . sendEvent ( { parent_id : thread ?. id , type : 'typing.stop' } as StreamEvent <
616+ At ,
617+ Ch ,
618+ Co ,
619+ Ev ,
620+ Me ,
621+ Re ,
622+ Us
623+ > ) ;
624+ }
625+ } , [ thread ?. id , channelId ] ) ;
626+
627+ useAppStateListener ( undefined , handleAppBackground ) ;
628+
611629 /**
612630 * CHANNEL CONSTANTS
613631 */
Original file line number Diff line number Diff line change 11import { useEffect , useState } from 'react' ;
22
3- import { useAppStateListener } from './useAppStateListener' ;
3+ import { useAppStateListener } from '../../../hooks /useAppStateListener' ;
44import { NetInfo } from '../../../native' ;
55
66import type { NetInfoSubscription } from '@react-native-community/netinfo' ;
Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ export * from './ChannelPreview/hooks/useChannelPreviewDisplayPresence';
7070export * from './ChannelPreview/hooks/useLatestMessagePreview' ;
7171
7272export * from './Chat/Chat' ;
73- export * from './Chat/hooks/useAppStateListener' ;
7473export * from './Chat/hooks/useCreateChatContext' ;
7574export * from './Chat/hooks/useIsOnline' ;
7675export * from './Chat/hooks/useMutedUsers' ;
Original file line number Diff line number Diff line change 1+ export * from './useAppStateListener' ;
File renamed without changes.
Original file line number Diff line number Diff line change 11export * from './components' ;
2+ export * from './hooks' ;
23export { registerNativeHandlers , NetInfo } from './native' ;
34export * from './contexts' ;
45export * from './emoji-data/compiled' ;
You canβt perform that action at this time.
0 commit comments