@@ -15,12 +15,11 @@ import { useStateStore } from 'stream-chat-react-native';
1515
1616import { ScreenHeader } from '../components/ScreenHeader' ;
1717
18- import type { RouteProp } from '@react-navigation/native' ;
18+ import { type RouteProp } from '@react-navigation/native' ;
1919
2020import type { StackNavigatorParamList } from '../types' ;
2121import { LocalMessage , ThreadState , UserResponse } from 'stream-chat' ;
2222import { useCreateDraftFocusEffect } from '../utils/useCreateDraftFocusEffect.tsx' ;
23- import { MessageReminderHeader } from '../components/Reminders/MessageReminderHeader.tsx' ;
2423import { channelMessageActions } from '../utils/messageActions.tsx' ;
2524import { useStreamChatContext } from '../context/StreamChatContext.tsx' ;
2625import { NativeStackNavigationProp } from '@react-navigation/native-stack' ;
@@ -74,7 +73,7 @@ const ThreadHeader: React.FC<ThreadHeaderProps> = ({ thread }) => {
7473export const ThreadScreen : React . FC < ThreadScreenProps > = ( {
7574 navigation,
7675 route : {
77- params : { channel, thread } ,
76+ params : { channel, thread, targetedMessageId } ,
7877 } ,
7978} ) => {
8079 const {
@@ -87,7 +86,6 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
8786 const { t } = useTranslationContext ( ) ;
8887 const { setThread } = useStreamChatContext ( ) ;
8988 const { messageInputFloating, messageListImplementation } = useAppContext ( ) ;
90-
9189 const onPressMessage : NonNullable < React . ComponentProps < typeof Channel > [ 'onPressMessage' ] > = (
9290 payload ,
9391 ) => {
@@ -118,6 +116,13 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
118116 setThread ( null ) ;
119117 } , [ setThread ] ) ;
120118
119+ const onBackPressThread = useCallback (
120+ ( messageId ?: string ) => {
121+ navigation . popTo ( 'ChannelScreen' , { messageId : messageId } ) ;
122+ } ,
123+ [ navigation ] ,
124+ ) ;
125+
121126 return (
122127 < View style = { [ styles . container , { backgroundColor : white } ] } >
123128 < Channel
@@ -128,14 +133,18 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
128133 keyboardVerticalOffset = { Platform . OS === 'ios' ? 0 : - 300 }
129134 messageActions = { messageActions }
130135 messageInputFloating = { messageInputFloating }
131- MessageHeader = { MessageReminderHeader }
132136 MessageLocation = { MessageLocation }
133137 onPressMessage = { onPressMessage }
134138 thread = { thread }
135139 threadList
140+ onBackPressThread = { onBackPressThread }
141+ messageId = { targetedMessageId }
136142 >
137143 < ThreadHeader thread = { thread } />
138- < Thread onThreadDismount = { onThreadDismount } shouldUseFlashList = { messageListImplementation === 'flashlist' } />
144+ < Thread
145+ onThreadDismount = { onThreadDismount }
146+ shouldUseFlashList = { messageListImplementation === 'flashlist' }
147+ />
139148 </ Channel >
140149 </ View >
141150 ) ;
0 commit comments