@@ -6,12 +6,16 @@ import {
66 Thread ,
77 useAttachmentPickerContext ,
88 useTheme ,
9+ ThreadContextValue ,
10+ useTypingString ,
911} from 'stream-chat-react-native' ;
1012
1113import { ScreenHeader } from '../components/ScreenHeader' ;
1214
1315import type { RouteProp } from '@react-navigation/native' ;
1416
17+ import type { Channel as StreamChatChannel } from 'stream-chat' ;
18+
1519import type {
1620 LocalAttachmentType ,
1721 LocalChannelType ,
@@ -34,6 +38,31 @@ type ThreadScreenRouteProp = RouteProp<StackNavigatorParamList, 'ThreadScreen'>;
3438type ThreadScreenProps = {
3539 route : ThreadScreenRouteProp ;
3640} ;
41+
42+ export type ThreadHeaderProps = {
43+ thread : ThreadContextValue <
44+ LocalAttachmentType ,
45+ LocalChannelType ,
46+ LocalCommandType ,
47+ LocalEventType ,
48+ LocalMessageType ,
49+ LocalReactionType ,
50+ LocalUserType
51+ > [ 'thread' ] ;
52+ } ;
53+
54+ const ThreadHeader : React . FC < ThreadHeaderProps > = ( { thread } ) => {
55+ const typing = useTypingString ( ) ;
56+
57+ return (
58+ < ScreenHeader
59+ inSafeArea
60+ titleText = 'Thread Reply'
61+ subtitleText = { typing ? typing : `with ${ thread ?. user ?. name } ` }
62+ />
63+ ) ;
64+ } ;
65+
3766export const ThreadScreen : React . FC < ThreadScreenProps > = ( {
3867 route : {
3968 params : { channel, thread } ,
@@ -51,6 +80,11 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
5180 return ( ) => setSelectedImages ( [ ] ) ;
5281 } , [ ] ) ;
5382
83+ useEffect ( ( ) => {
84+ setSelectedImages ( [ ] ) ;
85+ return ( ) => setSelectedImages ( [ ] ) ;
86+ } , [ ] ) ;
87+
5488 return (
5589 < SafeAreaView style = { [ styles . container , { backgroundColor : white } ] } >
5690 < Channel <
@@ -68,11 +102,7 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
68102 thread = { thread }
69103 >
70104 < View style = { styles . container } >
71- < ScreenHeader
72- inSafeArea
73- subtitleText = { `with ${ thread ?. user ?. name } ` }
74- titleText = 'Thread Reply'
75- />
105+ < ThreadHeader thread = { thread } />
76106 < Thread <
77107 LocalAttachmentType ,
78108 LocalChannelType ,
0 commit comments