b445c15cc9
* Move broadcast channel to lib * Refactor view/com/post/Post and remove temporary 2 components * Add useModerationOpts hook * Refactor notifications to use react-query * Fix: only trigger updates in useModerationOpts when the values have changed * Implement unread notification tracking * Add moderation filtering to notifications * Handle native/push notifications * Remove dead code --------- Co-authored-by: Eric Bailey <git@esb.lol>
17 lines
552 B
TypeScript
17 lines
552 B
TypeScript
import {useEffect} from 'react'
|
|
import {useNavigation} from '@react-navigation/native'
|
|
|
|
import {NavigationProp} from 'lib/routes/types'
|
|
import {bskyTitle} from 'lib/strings/headings'
|
|
import {useUnreadNotifications} from '#/state/queries/notifications/unread'
|
|
|
|
export function useSetTitle(title?: string) {
|
|
const navigation = useNavigation<NavigationProp>()
|
|
const numUnread = useUnreadNotifications()
|
|
useEffect(() => {
|
|
if (title) {
|
|
navigation.setOptions({title: bskyTitle(title, numUnread)})
|
|
}
|
|
}, [title, navigation, numUnread])
|
|
}
|