Update layouts on a bunch of views

zio/stable
Paul Frazee 2023-01-26 20:33:47 -06:00
parent 9659625e8e
commit df57c69f06
6 changed files with 37 additions and 26 deletions

View File

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {FlatList, StyleSheet, View} from 'react-native' import {StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views'
import {NotificationsViewModel} from '../../../state/models/notifications-view' import {NotificationsViewModel} from '../../../state/models/notifications-view'
import {FeedItem} from './FeedItem' import {FeedItem} from './FeedItem'
import {NotificationFeedLoadingPlaceholder} from '../util/LoadingPlaceholder' import {NotificationFeedLoadingPlaceholder} from '../util/LoadingPlaceholder'
@ -60,10 +61,15 @@ export const Feed = observer(function Feed({
} }
return ( return (
<View style={s.h100pct}> <View style={s.h100pct}>
<CenteredView>
{view.isLoading && !data && <NotificationFeedLoadingPlaceholder />} {view.isLoading && !data && <NotificationFeedLoadingPlaceholder />}
{view.hasError && ( {view.hasError && (
<ErrorMessage message={view.error} onPressTryAgain={onPressTryAgain} /> <ErrorMessage
message={view.error}
onPressTryAgain={onPressTryAgain}
/>
)} )}
</CenteredView>
{data && ( {data && (
<FlatList <FlatList
data={data} data={data}

View File

@ -1,6 +1,7 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, FlatList, StyleSheet, View} from 'react-native' import {ActivityIndicator, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views'
import { import {
RepostedByViewModel, RepostedByViewModel,
RepostedByItem, RepostedByItem,
@ -42,9 +43,9 @@ export const PostRepostedBy = observer(function PostRepostedBy({
if (!view.hasLoaded) { if (!view.hasLoaded) {
return ( return (
<View> <CenteredView>
<ActivityIndicator /> <ActivityIndicator />
</View> </CenteredView>
) )
} }
@ -52,9 +53,9 @@ export const PostRepostedBy = observer(function PostRepostedBy({
// = // =
if (view.hasError) { if (view.hasError) {
return ( return (
<View> <CenteredView>
<ErrorMessage message={view.error} onPressTryAgain={onRefresh} /> <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
</View> </CenteredView>
) )
} }

View File

@ -1,6 +1,7 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, FlatList, StyleSheet, View} from 'react-native' import {ActivityIndicator, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views'
import {VotesViewModel, VoteItem} from '../../../state/models/votes-view' import {VotesViewModel, VoteItem} from '../../../state/models/votes-view'
import {Link} from '../util/Link' import {Link} from '../util/Link'
import {Text} from '../util/text/Text' import {Text} from '../util/text/Text'
@ -38,9 +39,9 @@ export const PostVotedBy = observer(function PostVotedBy({
if (!view.hasLoaded) { if (!view.hasLoaded) {
return ( return (
<View> <CenteredView>
<ActivityIndicator /> <ActivityIndicator />
</View> </CenteredView>
) )
} }
@ -48,9 +49,9 @@ export const PostVotedBy = observer(function PostVotedBy({
// = // =
if (view.hasError) { if (view.hasError) {
return ( return (
<View> <CenteredView>
<ErrorMessage message={view.error} onPressTryAgain={onRefresh} /> <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
</View> </CenteredView>
) )
} }

View File

@ -1,10 +1,11 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, FlatList, StyleSheet, View} from 'react-native' import {ActivityIndicator, StyleSheet, View} from 'react-native'
import { import {
UserFollowersViewModel, UserFollowersViewModel,
FollowerItem, FollowerItem,
} from '../../../state/models/user-followers-view' } from '../../../state/models/user-followers-view'
import {CenteredView, FlatList} from '../util/Views'
import {Link} from '../util/Link' import {Link} from '../util/Link'
import {Text} from '../util/text/Text' import {Text} from '../util/text/Text'
import {ErrorMessage} from '../util/error/ErrorMessage' import {ErrorMessage} from '../util/error/ErrorMessage'
@ -43,9 +44,9 @@ export const ProfileFollowers = observer(function ProfileFollowers({
if (!view.hasLoaded) { if (!view.hasLoaded) {
return ( return (
<View> <CenteredView>
<ActivityIndicator /> <ActivityIndicator />
</View> </CenteredView>
) )
} }
@ -53,9 +54,9 @@ export const ProfileFollowers = observer(function ProfileFollowers({
// = // =
if (view.hasError) { if (view.hasError) {
return ( return (
<View> <CenteredView>
<ErrorMessage message={view.error} onPressTryAgain={onRefresh} /> <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
</View> </CenteredView>
) )
} }

View File

@ -1,6 +1,7 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, FlatList, StyleSheet, View} from 'react-native' import {ActivityIndicator, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views'
import { import {
UserFollowsViewModel, UserFollowsViewModel,
FollowItem, FollowItem,
@ -43,9 +44,9 @@ export const ProfileFollows = observer(function ProfileFollows({
if (!view.hasLoaded) { if (!view.hasLoaded) {
return ( return (
<View> <CenteredView>
<ActivityIndicator /> <ActivityIndicator />
</View> </CenteredView>
) )
} }
@ -53,9 +54,9 @@ export const ProfileFollows = observer(function ProfileFollows({
// = // =
if (view.hasError) { if (view.hasError) {
return ( return (
<View> <CenteredView>
<ErrorMessage message={view.error} onPressTryAgain={onRefresh} /> <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
</View> </CenteredView>
) )
} }

View File

@ -1,7 +1,8 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {ScrollView, StyleSheet, TouchableOpacity, View} from 'react-native' import {StyleSheet, TouchableOpacity, View} from 'react-native'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {ScrollView} from '../com/util/Views'
import {useStores} from '../../state' import {useStores} from '../../state'
import {ScreenParams} from '../routes' import {ScreenParams} from '../routes'
import {s} from '../lib/styles' import {s} from '../lib/styles'