Use consistent spinners for loading screens (#2611)
* Use consistent spinners for loading screens * Consolidate into LoadingScreen
This commit is contained in:
parent
9ff74ff30a
commit
c2733bc2c0
8 changed files with 31 additions and 46 deletions
|
@ -6,6 +6,7 @@ import {List} from '../util/List'
|
|||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||
import {ProfileCardWithFollowBtn} from '../profile/ProfileCard'
|
||||
import {logger} from '#/logger'
|
||||
import {LoadingScreen} from '../util/LoadingScreen'
|
||||
import {useResolveUriQuery} from '#/state/queries/resolve-uri'
|
||||
import {usePostLikedByQuery} from '#/state/queries/post-liked-by'
|
||||
import {cleanError} from '#/lib/strings/errors'
|
||||
|
@ -60,11 +61,7 @@ export function PostLikedBy({uri}: {uri: string}) {
|
|||
}, [])
|
||||
|
||||
if (isFetchingResolvedUri || !isFetched) {
|
||||
return (
|
||||
<CenteredView>
|
||||
<ActivityIndicator />
|
||||
</CenteredView>
|
||||
)
|
||||
return <LoadingScreen />
|
||||
}
|
||||
|
||||
// error
|
||||
|
|
|
@ -6,6 +6,7 @@ import {List} from '../util/List'
|
|||
import {ProfileCardWithFollowBtn} from '../profile/ProfileCard'
|
||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||
import {logger} from '#/logger'
|
||||
import {LoadingScreen} from '../util/LoadingScreen'
|
||||
import {useResolveUriQuery} from '#/state/queries/resolve-uri'
|
||||
import {usePostRepostedByQuery} from '#/state/queries/post-reposted-by'
|
||||
import {cleanError} from '#/lib/strings/errors'
|
||||
|
@ -61,11 +62,7 @@ export function PostRepostedBy({uri}: {uri: string}) {
|
|||
)
|
||||
|
||||
if (isFetchingResolvedUri || !isFetched) {
|
||||
return (
|
||||
<CenteredView>
|
||||
<ActivityIndicator />
|
||||
</CenteredView>
|
||||
)
|
||||
return <LoadingScreen />
|
||||
}
|
||||
|
||||
// error
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
} from 'react-native'
|
||||
import {AppBskyFeedDefs} from '@atproto/api'
|
||||
import {CenteredView} from '../util/Views'
|
||||
import {LoadingScreen} from '../util/LoadingScreen'
|
||||
import {List, ListMethods} from '../util/List'
|
||||
import {
|
||||
FontAwesomeIcon,
|
||||
|
@ -125,13 +126,7 @@ export function PostThread({
|
|||
return <PostThreadBlocked />
|
||||
}
|
||||
if (!thread || isLoading || !preferences) {
|
||||
return (
|
||||
<CenteredView>
|
||||
<View style={s.p20}>
|
||||
<ActivityIndicator size="large" />
|
||||
</View>
|
||||
</CenteredView>
|
||||
)
|
||||
return <LoadingScreen />
|
||||
}
|
||||
return (
|
||||
<PostThreadLoaded
|
||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
|||
import {ActivityIndicator, StyleSheet, View} from 'react-native'
|
||||
import {AppBskyActorDefs as ActorDefs} from '@atproto/api'
|
||||
import {CenteredView} from '../util/Views'
|
||||
import {LoadingScreen} from '../util/LoadingScreen'
|
||||
import {List} from '../util/List'
|
||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||
import {ProfileCardWithFollowBtn} from './ProfileCard'
|
||||
|
@ -62,11 +63,7 @@ export function ProfileFollowers({name}: {name: string}) {
|
|||
)
|
||||
|
||||
if (isFetchingDid || !isFetched) {
|
||||
return (
|
||||
<CenteredView>
|
||||
<ActivityIndicator />
|
||||
</CenteredView>
|
||||
)
|
||||
return <LoadingScreen />
|
||||
}
|
||||
|
||||
// error
|
||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
|||
import {ActivityIndicator, StyleSheet, View} from 'react-native'
|
||||
import {AppBskyActorDefs as ActorDefs} from '@atproto/api'
|
||||
import {CenteredView} from '../util/Views'
|
||||
import {LoadingScreen} from '../util/LoadingScreen'
|
||||
import {List} from '../util/List'
|
||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||
import {ProfileCardWithFollowBtn} from './ProfileCard'
|
||||
|
@ -62,11 +63,7 @@ export function ProfileFollows({name}: {name: string}) {
|
|||
)
|
||||
|
||||
if (isFetchingDid || !isFetched) {
|
||||
return (
|
||||
<CenteredView>
|
||||
<ActivityIndicator />
|
||||
</CenteredView>
|
||||
)
|
||||
return <LoadingScreen />
|
||||
}
|
||||
|
||||
// error
|
||||
|
|
14
src/view/com/util/LoadingScreen.tsx
Normal file
14
src/view/com/util/LoadingScreen.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import React from 'react'
|
||||
import {ActivityIndicator, View} from 'react-native'
|
||||
import {s} from 'lib/styles'
|
||||
import {CenteredView} from './Views'
|
||||
|
||||
export function LoadingScreen() {
|
||||
return (
|
||||
<CenteredView>
|
||||
<View style={s.p20}>
|
||||
<ActivityIndicator size="large" />
|
||||
</View>
|
||||
</CenteredView>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue