Merge pull request #1954 from ecency/nt/tabbed-posts-improvments

improved empty list view
This commit is contained in:
Feruz M 2021-05-24 10:19:34 +03:00 committed by GitHub
commit c24739ffb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 8 deletions

View File

@ -1,18 +1,24 @@
import React from 'react';
import { View, Text } from 'react-native';
import { View, Text, TextStyle, ViewStyle } from 'react-native';
import LottieView from 'lottie-react-native';
import { useIntl } from 'react-intl';
import styles from './emptyScreenStyles';
import globalStyles from '../../../../globalStyles';
const EmptyScreenView = ({ style, textStyle, text }) => {
interface Props {
style?:ViewStyle;
textStyle?:TextStyle;
text?:string;
}
const EmptyScreenView = ({ style, textStyle, text } : Props) => {
const intl = useIntl();
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', ...style }}>
<LottieView
style={[{ width: 150, height: 150, marginBottom: 12 }, style]}
style={{ width: 150, height: 150, marginBottom: 12}}
source={require('../../../../assets/animations/empty_screen.json')}
autoPlay
loop={true}

View File

@ -82,7 +82,7 @@ const postsListContainer = ({
const _renderFooter = () => {
if (isLoading) {
if (isLoading && !isRefreshing) {
return (
<View style={styles.flatlistFooter}>
<ActivityIndicator animating size="large" color={'#2e3d51'} />

View File

@ -4,7 +4,7 @@ import { get } from 'lodash';
import { Text, View, FlatList } from 'react-native';
import { NoPost, PostCardPlaceHolder, UserListItem } from '../..';
import globalStyles from '../../../globalStyles';
import { CommunityListItem } from '../../basicUIElements';
import { CommunityListItem, EmptyScreen } from '../../basicUIElements';
import styles from './tabbedPostsStyles';
import { default as ROUTES } from '../../../constants/routeNames';
import { withNavigation } from 'react-navigation';
@ -22,7 +22,7 @@ interface TabEmptyViewProps {
const TabEmptyView = ({
filterKey,
isNoPost,
navigation
navigation,
}: TabEmptyViewProps) => {
const intl = useIntl();
@ -326,7 +326,9 @@ const TabEmptyView = ({
</>
);
} else {
return <Text style={[globalStyles.subTitle, styles.noPostTitle]}>{intl.formatMessage({ id: 'profile.havent_posted' })}</Text>;
return (
<EmptyScreen style={styles.emptyAnimationContainer} />
)
}
}

View File

@ -78,4 +78,7 @@ export default EStyleSheet.create({
marginLeft: -8,
borderColor: '$primaryBlue',
},
emptyAnimationContainer:{
marginTop:56
}
});