Improve error messages

This commit is contained in:
Paul Frazee 2022-11-15 10:46:12 -06:00
parent 6e93301542
commit fb3a43c216
15 changed files with 156 additions and 32 deletions

View file

@ -6,11 +6,14 @@ import {
NotificationsViewItemModel,
} from '../../../state/models/notifications-view'
import {FeedItem} from './FeedItem'
import {ErrorMessage} from '../util/ErrorMessage'
export const Feed = observer(function Feed({
view,
onPressTryAgain,
}: {
view: NotificationsViewModel
onPressTryAgain?: () => void
}) {
// TODO optimize renderItem or FeedItem, we're getting this notice from RN: -prf
// VirtualizedList: You have a large list that is slow to update - make sure your
@ -30,7 +33,14 @@ export const Feed = observer(function Feed({
{view.isLoading && !view.isRefreshing && !view.hasContent && (
<Text>Loading...</Text>
)}
{view.hasError && <Text>{view.error}</Text>}
{view.hasError && (
<ErrorMessage
dark
message={view.error}
style={{margin: 6}}
onPressTryAgain={onPressTryAgain}
/>
)}
{view.hasContent && (
<FlatList
data={view.notifications}