diff options
author | LW <git@llllvvuu.dev> | 2023-05-17 07:50:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 09:50:28 -0500 |
commit | 41f3a0551511c7141aa416efe92130c4bf020214 (patch) | |
tree | 5f50d9e33373ca1f05ad5d10209693864ccf76fa /src/lib/hooks/useUnreadCountLabel.ts | |
parent | 656baa723913951e2a2961f00f0e5219660d0885 (diff) | |
download | voidsky-41f3a0551511c7141aa416efe92130c4bf020214.tar.zst |
I just realized how `mobx` works (never used before lol) and now I feel dumb.
Diffstat (limited to 'src/lib/hooks/useUnreadCountLabel.ts')
-rw-r--r-- | src/lib/hooks/useUnreadCountLabel.ts | 19 |
1 files changed, 0 insertions, 19 deletions
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 <RootStoreContext.Consumer /> - // 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 -} |