make empty feed required (#1667)

zio/stable
Ansh 2023-10-10 14:32:00 -07:00 committed by GitHub
parent 4d450da194
commit aa085b0b14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -45,7 +45,7 @@ export const Feed = observer(function Feed({
onPressTryAgain?: () => void onPressTryAgain?: () => void
onScroll?: OnScrollCb onScroll?: OnScrollCb
scrollEventThrottle?: number scrollEventThrottle?: number
renderEmptyState?: () => JSX.Element renderEmptyState: () => JSX.Element
renderEndOfFeed?: () => JSX.Element renderEndOfFeed?: () => JSX.Element
testID?: string testID?: string
headerOffset?: number headerOffset?: number
@ -116,10 +116,7 @@ export const Feed = observer(function Feed({
const renderItem = React.useCallback( const renderItem = React.useCallback(
({item}: {item: any}) => { ({item}: {item: any}) => {
if (item === EMPTY_FEED_ITEM) { if (item === EMPTY_FEED_ITEM) {
if (renderEmptyState) {
return renderEmptyState() return renderEmptyState()
}
return <View />
} else if (item === ERROR_ITEM) { } else if (item === ERROR_ITEM) {
return ( return (
<ErrorMessage <ErrorMessage

View File

@ -160,7 +160,7 @@ const FeedPage = observer(function FeedPageImpl({
testID?: string testID?: string
feed: PostsFeedModel feed: PostsFeedModel
isPageFocused: boolean isPageFocused: boolean
renderEmptyState?: () => JSX.Element renderEmptyState: () => JSX.Element
renderEndOfFeed?: () => JSX.Element renderEndOfFeed?: () => JSX.Element
}) { }) {
const store = useStores() const store = useStores()