Add the view header as a feed item
This commit is contained in:
parent
44fcdca06a
commit
4a16b179e2
1 changed files with 5 additions and 1 deletions
|
@ -12,6 +12,7 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome'
|
||||||
import {CenteredView, FlatList} from '../util/Views'
|
import {CenteredView, FlatList} from '../util/Views'
|
||||||
import {PostFeedLoadingPlaceholder} from '../util/LoadingPlaceholder'
|
import {PostFeedLoadingPlaceholder} from '../util/LoadingPlaceholder'
|
||||||
|
import {ViewHeader} from '../util/ViewHeader'
|
||||||
import {Text} from '../util/text/Text'
|
import {Text} from '../util/text/Text'
|
||||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||||
import {Button} from '../util/forms/Button'
|
import {Button} from '../util/forms/Button'
|
||||||
|
@ -24,6 +25,7 @@ import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {MagnifyingGlassIcon} from 'lib/icons'
|
import {MagnifyingGlassIcon} from 'lib/icons'
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
import {NavigationProp} from 'lib/routes/types'
|
||||||
|
|
||||||
|
const HEADER_ITEM = {_reactKey: '__header__'}
|
||||||
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
|
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
|
||||||
const ERROR_FEED_ITEM = {_reactKey: '__error__'}
|
const ERROR_FEED_ITEM = {_reactKey: '__error__'}
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ export const Feed = observer(function Feed({
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
|
||||||
const data = React.useMemo(() => {
|
const data = React.useMemo(() => {
|
||||||
let feedItems: any[] = []
|
let feedItems: any[] = [HEADER_ITEM]
|
||||||
if (feed.hasLoaded) {
|
if (feed.hasLoaded) {
|
||||||
if (feed.hasError) {
|
if (feed.hasError) {
|
||||||
feedItems = feedItems.concat([ERROR_FEED_ITEM])
|
feedItems = feedItems.concat([ERROR_FEED_ITEM])
|
||||||
|
@ -133,6 +135,8 @@ export const Feed = observer(function Feed({
|
||||||
onPressTryAgain={onPressTryAgain}
|
onPressTryAgain={onPressTryAgain}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
} else if (item === HEADER_ITEM) {
|
||||||
|
return <ViewHeader title="Bluesky" canGoBack={false} />
|
||||||
}
|
}
|
||||||
return <FeedSlice slice={item} showFollowBtn={showPostFollowBtn} />
|
return <FeedSlice slice={item} showFollowBtn={showPostFollowBtn} />
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue