From 41f3a0551511c7141aa416efe92130c4bf020214 Mon Sep 17 00:00:00 2001 From: LW Date: Wed, 17 May 2023 07:50:28 -0700 Subject: style: remove `useUnreadCountLabel` hack from `50c1841` (#655) (#686) I just realized how `mobx` works (never used before lol) and now I feel dumb. --- src/lib/hooks/useSetTitle.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/hooks/useSetTitle.ts') diff --git a/src/lib/hooks/useSetTitle.ts b/src/lib/hooks/useSetTitle.ts index 85ba44d29..c5c7a5ca1 100644 --- a/src/lib/hooks/useSetTitle.ts +++ b/src/lib/hooks/useSetTitle.ts @@ -3,11 +3,15 @@ import {useNavigation} from '@react-navigation/native' import {NavigationProp} from 'lib/routes/types' import {bskyTitle} from 'lib/strings/headings' -import {useUnreadCountLabel} from './useUnreadCountLabel' +import {useStores} from 'state/index' +/** + * Requires consuming component to be wrapped in `observer`: + * https://stackoverflow.com/a/71488009 + */ export function useSetTitle(title?: string) { const navigation = useNavigation() - const unreadCountLabel = useUnreadCountLabel() + const {unreadCountLabel} = useStores().me.notifications useEffect(() => { if (title) { navigation.setOptions({title: bskyTitle(title, unreadCountLabel)}) -- cgit 1.4.1