diff options
Diffstat (limited to 'src/view/com/post-thread')
-rw-r--r-- | src/view/com/post-thread/PostRepostedBy.tsx | 21 | ||||
-rw-r--r-- | src/view/com/post-thread/PostThread.tsx | 8 | ||||
-rw-r--r-- | src/view/com/post-thread/PostVotedBy.tsx | 12 |
3 files changed, 30 insertions, 11 deletions
diff --git a/src/view/com/post-thread/PostRepostedBy.tsx b/src/view/com/post-thread/PostRepostedBy.tsx index 53f0e0b35..ca5cc476a 100644 --- a/src/view/com/post-thread/PostRepostedBy.tsx +++ b/src/view/com/post-thread/PostRepostedBy.tsx @@ -1,18 +1,12 @@ import React, {useState, useEffect} from 'react' import {observer} from 'mobx-react-lite' -import { - ActivityIndicator, - FlatList, - Image, - StyleSheet, - Text, - View, -} from 'react-native' +import {ActivityIndicator, FlatList, StyleSheet, Text, View} from 'react-native' import { RepostedByViewModel, RepostedByViewItemModel, } from '../../../state/models/reposted-by-view' import {UserAvatar} from '../util/UserAvatar' +import {ErrorMessage} from '../util/ErrorMessage' import {Link} from '../util/Link' import {useStores} from '../../../state' import {s, colors} from '../../lib/styles' @@ -38,6 +32,10 @@ export const PostRepostedBy = observer(function PostRepostedBy({ .catch(err => console.error('Failed to fetch reposted by', err)) }, [uri, view?.params.uri, store]) + const onRefresh = () => { + view?.refresh() + } + // loading // = if ( @@ -57,7 +55,12 @@ export const PostRepostedBy = observer(function PostRepostedBy({ if (view.hasError) { return ( <View> - <Text>{view.error}</Text> + <ErrorMessage + dark + message={view.error} + style={{margin: 6}} + onPressTryAgain={onRefresh} + /> </View> ) } diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 0349d3428..ee87a6bff 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -8,6 +8,7 @@ import { import {useStores} from '../../../state' import {SharePostModel} from '../../../state/models/shell-ui' import {PostThreadItem} from './PostThreadItem' +import {ErrorMessage} from '../util/ErrorMessage' export const PostThread = observer(function PostThread({uri}: {uri: string}) { const store = useStores() @@ -50,7 +51,12 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) { if (view.hasError) { return ( <View> - <Text>{view.error}</Text> + <ErrorMessage + dark + message={view.error} + style={{margin: 6}} + onPressTryAgain={onRefresh} + /> </View> ) } diff --git a/src/view/com/post-thread/PostVotedBy.tsx b/src/view/com/post-thread/PostVotedBy.tsx index 596a6a1db..ad85d077f 100644 --- a/src/view/com/post-thread/PostVotedBy.tsx +++ b/src/view/com/post-thread/PostVotedBy.tsx @@ -6,6 +6,7 @@ import { VotesViewItemModel, } from '../../../state/models/votes-view' import {Link} from '../util/Link' +import {ErrorMessage} from '../util/ErrorMessage' import {UserAvatar} from '../util/UserAvatar' import {useStores} from '../../../state' import {s, colors} from '../../lib/styles' @@ -31,6 +32,10 @@ export const PostVotedBy = observer(function PostVotedBy({ newView.setup().catch(err => console.error('Failed to fetch voted by', err)) }, [uri, view?.params.uri, store]) + const onRefresh = () => { + view?.refresh() + } + // loading // = if ( @@ -50,7 +55,12 @@ export const PostVotedBy = observer(function PostVotedBy({ if (view.hasError) { return ( <View> - <Text>{view.error}</Text> + <ErrorMessage + dark + message={view.error} + style={{margin: 6}} + onPressTryAgain={onRefresh} + /> </View> ) } |