diff options
Diffstat (limited to 'src/screens/Messages/List/index.tsx')
-rw-r--r-- | src/screens/Messages/List/index.tsx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/screens/Messages/List/index.tsx b/src/screens/Messages/List/index.tsx index 4d218bda8..6c07073a8 100644 --- a/src/screens/Messages/List/index.tsx +++ b/src/screens/Messages/List/index.tsx @@ -40,11 +40,12 @@ import {ClipClopGate} from '../gate' import {useDmServiceUrlStorage} from '../Temp/useDmServiceUrlStorage' type Props = NativeStackScreenProps<MessagesTabNavigatorParams, 'Messages'> -export function MessagesScreen({navigation}: Props) { +export function MessagesScreen({navigation, route}: Props) { const {_} = useLingui() const t = useTheme() const newChatControl = useDialogControl() const {gtMobile} = useBreakpoints() + const pushToConversation = route.params?.pushToConversation // TEMP const {serviceUrl, setServiceUrl} = useDmServiceUrlStorage() @@ -57,6 +58,19 @@ export function MessagesScreen({navigation}: Props) { ) }, [serviceUrl]) + // Whenever we have `pushToConversation` set, it means we pressed a notification for a chat without being on + // this tab. We should immediately push to the conversation after pressing the notification. + // After we push, reset with `setParams` so that this effect will fire next time we press a notification, even if + // the conversation is the same as before + React.useEffect(() => { + if (pushToConversation) { + navigation.navigate('MessagesConversation', { + conversation: pushToConversation, + }) + navigation.setParams({pushToConversation: undefined}) + } + }, [navigation, pushToConversation]) + const renderButton = useCallback(() => { return ( <Link |