blob: dd6e0761170cd93c508bfb001f1c16aefb2b818c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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
}
store.log.debug('Updating notifications feed')
store.me.notifications
.update()
.catch(e => {
store.log.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>
)
}
|