Files
bsky-social-app/src/view/screens/Notifications.tsx
T
Paul Frazee 44ae514d89 Add a design system (#34)
* Add theming system

* Add standard Button control and update RadioButtons

* Unify radiobutton with design system

* Update debug screen to have multiple views

* Add ToggleButton

* Update error controls to use design system

* Add typography to <Text> element

* Move DropdownButton into the design system

* Clean out old code

* Move Text into design system

* Add 'inverted' color palette

* Move LoadingPlaceholder into the design system
2022-12-28 14:06:01 -06:00

45 lines
1.2 KiB
TypeScript

import React, {useEffect} from 'react'
import {View} from 'react-native'
import {ViewHeader} from '../com/util/ViewHeader'
import {Feed} from '../com/notifications/Feed'
import {useStores} from '../../state'
import {ScreenParams} from '../routes'
import {useOnMainScroll} from '../lib/hooks/useOnMainScroll'
export const Notifications = ({navIdx, visible}: ScreenParams) => {
const store = useStores()
const onMainScroll = useOnMainScroll(store)
useEffect(() => {
if (!visible) {
return
}
console.log('Updating notifications feed')
store.me.refreshMemberships() // needed for the invite notifications
store.me.notifications
.update()
.catch(e => {
console.error('Error while updating notifications feed', e)
})
.then(() => {
store.me.notifications.updateReadState()
})
store.nav.setTitle(navIdx, 'Notifications')
}, [visible, store])
const onPressTryAgain = () => {
store.me.notifications.refresh()
}
return (
<View style={{flex: 1}}>
<ViewHeader title="Notifications" canGoBack={false} />
<Feed
view={store.me.notifications}
onPressTryAgain={onPressTryAgain}
onScroll={onMainScroll}
/>
</View>
)
}