Replace mobx-state-tree with mobx and get a basic home feed rendering
This commit is contained in:
parent
6b32698b3e
commit
dc55f58004
20 changed files with 534 additions and 273 deletions
17
src/view/com/Feed.tsx
Normal file
17
src/view/com/Feed.tsx
Normal file
|
@ -0,0 +1,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>
|
||||
)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue