Fix duplicate 'end of feed' issue
parent
9e5940f0ab
commit
5fa3c16d0d
|
@ -100,13 +100,15 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
let items: any[] = []
|
let items: any[] = []
|
||||||
if (uiState) {
|
if (uiState) {
|
||||||
if (uiState.isInitialLoading) {
|
if (uiState.isInitialLoading) {
|
||||||
items.push(LOADING_ITEM)
|
items = items.concat([LOADING_ITEM])
|
||||||
renderItem = () => <PostFeedLoadingPlaceholder />
|
renderItem = () => <PostFeedLoadingPlaceholder />
|
||||||
} else if (uiState.currentView.hasError) {
|
} else if (uiState.currentView.hasError) {
|
||||||
items.push({
|
items = items.concat([
|
||||||
_reactKey: '__error__',
|
{
|
||||||
error: uiState.currentView.error,
|
_reactKey: '__error__',
|
||||||
})
|
error: uiState.currentView.error,
|
||||||
|
},
|
||||||
|
])
|
||||||
renderItem = (item: any) => (
|
renderItem = (item: any) => (
|
||||||
<View style={s.p5}>
|
<View style={s.p5}>
|
||||||
<ErrorMessage
|
<ErrorMessage
|
||||||
|
@ -129,7 +131,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
items = uiState.feed.feed.slice()
|
items = uiState.feed.feed.slice()
|
||||||
}
|
}
|
||||||
if (!uiState.feed.hasMore) {
|
if (!uiState.feed.hasMore) {
|
||||||
items.push(END_ITEM)
|
items = items.concat([END_ITEM])
|
||||||
}
|
}
|
||||||
renderItem = (item: any) => {
|
renderItem = (item: any) => {
|
||||||
if (item === END_ITEM) {
|
if (item === END_ITEM) {
|
||||||
|
@ -138,7 +140,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
return <FeedItem item={item} />
|
return <FeedItem item={item} />
|
||||||
}
|
}
|
||||||
} else if (uiState.feed.isEmpty) {
|
} else if (uiState.feed.isEmpty) {
|
||||||
items.push(EMPTY_ITEM)
|
items = items.concat([EMPTY_ITEM])
|
||||||
if (uiState.profile.isScene) {
|
if (uiState.profile.isScene) {
|
||||||
renderItem = () => (
|
renderItem = () => (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
|
@ -170,7 +172,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (uiState.memberships.isEmpty) {
|
} else if (uiState.memberships.isEmpty) {
|
||||||
items.push(EMPTY_ITEM)
|
items = items.concat([EMPTY_ITEM])
|
||||||
renderItem = () => (
|
renderItem = () => (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
icon="user-group"
|
icon="user-group"
|
||||||
|
@ -207,7 +209,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (uiState.members.isEmpty) {
|
} else if (uiState.members.isEmpty) {
|
||||||
items.push(EMPTY_ITEM)
|
items = items.concat([EMPTY_ITEM])
|
||||||
renderItem = () => (
|
renderItem = () => (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
icon="user-group"
|
icon="user-group"
|
||||||
|
@ -216,7 +218,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
items.push(EMPTY_ITEM)
|
items = items.concat([EMPTY_ITEM])
|
||||||
renderItem = () => <Text>TODO</Text>
|
renderItem = () => <Text>TODO</Text>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue