blob: 2cba0610a37a1e2b1446862f12be1d40444a78cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import React from 'react'
import {observer} from 'mobx-react-lite'
import {Text, View} from 'react-native'
import {FeedViewModel} from '../../state/models/feed-view'
import {FeedItem} from './FeedItem'
export const Feed = observer(function Feed({feed}: {feed: FeedViewModel}) {
return (
<View>
{feed.isLoading && <Text>Loading...</Text>}
{feed.hasError && <Text>{feed.error}</Text>}
{feed.hasContent &&
feed.feed.map(item => <FeedItem key={item.key} item={item} />)}
{feed.isEmpty && <Text>This feed is empty!</Text>}
</View>
)
})
|