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/useUnreadCountLabel.ts | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/lib/hooks/useUnreadCountLabel.ts (limited to 'src/lib/hooks/useUnreadCountLabel.ts') diff --git a/src/lib/hooks/useUnreadCountLabel.ts b/src/lib/hooks/useUnreadCountLabel.ts deleted file mode 100644 index e2bf77885..000000000 --- a/src/lib/hooks/useUnreadCountLabel.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {useEffect, useReducer} from 'react' -import {DeviceEventEmitter} from 'react-native' -import {useStores} from 'state/index' - -export function useUnreadCountLabel() { - // HACK: We don't have anything like Redux selectors, - // and we don't want to use - // to react to the whole store - const [, forceUpdate] = useReducer(x => x + 1, 0) - useEffect(() => { - const subscription = DeviceEventEmitter.addListener( - 'unread-notifications', - forceUpdate, - ) - return () => subscription?.remove() - }, [forceUpdate]) - - return useStores().me.notifications.unreadCountLabel -} -- cgit 1.4.1