diff options
author | Eric Bailey <git@esb.lol> | 2024-05-07 20:25:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 20:25:58 -0500 |
commit | 165fdb704959837d244eebf12f61803676b15366 (patch) | |
tree | d3d2e28631ddd643bd05fe46d63792b5a661ac7b /src/screens/Messages/Conversation/index.tsx | |
parent | 37f22ca2246f81e17be113f05aeeb4cd1a886b1b (diff) | |
download | voidsky-165fdb704959837d244eebf12f61803676b15366.tar.zst |
[🐴] Integrate global event bus (#3904)
* Conditionally run global event bus * Add current convo id context, bundle providers
Diffstat (limited to 'src/screens/Messages/Conversation/index.tsx')
-rw-r--r-- | src/screens/Messages/Conversation/index.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/screens/Messages/Conversation/index.tsx b/src/screens/Messages/Conversation/index.tsx index 2a4f14a5e..7b78e7e61 100644 --- a/src/screens/Messages/Conversation/index.tsx +++ b/src/screens/Messages/Conversation/index.tsx @@ -5,11 +5,12 @@ import {AppBskyActorDefs} from '@atproto/api' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' -import {useNavigation} from '@react-navigation/native' +import {useFocusEffect, useNavigation} from '@react-navigation/native' import {NativeStackScreenProps} from '@react-navigation/native-stack' import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types' import {useGate} from '#/lib/statsig/statsig' +import {useCurrentConvoId} from '#/state/messages/current-convo-id' import {BACK_HITSLOP} from 'lib/constants' import {isWeb} from 'platform/detection' import {ChatProvider, useChat} from 'state/messages' @@ -31,6 +32,16 @@ type Props = NativeStackScreenProps< export function MessagesConversationScreen({route}: Props) { const gate = useGate() const convoId = route.params.conversation + const {setCurrentConvoId} = useCurrentConvoId() + + useFocusEffect( + useCallback(() => { + setCurrentConvoId(convoId) + return () => { + setCurrentConvoId(undefined) + } + }, [convoId, setCurrentConvoId]), + ) if (!gate('dms')) return <ClipClopGate /> |