mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-12 13:05:41 +03:00
rendering empty content
This commit is contained in:
parent
853b31a1cb
commit
9d3edaaeb3
14
src/components/postComments/children/postComments.styles.tsx
Normal file
14
src/components/postComments/children/postComments.styles.tsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||||
|
|
||||||
|
export default EStyleSheet.create({
|
||||||
|
list: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
emptyText: {
|
||||||
|
color: '$primaryDarkGray',
|
||||||
|
fontSize: 16,
|
||||||
|
justifyContent: 'center',
|
||||||
|
marginTop: 5,
|
||||||
|
padding: 32,
|
||||||
|
},
|
||||||
|
});
|
@ -6,7 +6,7 @@ import React, {
|
|||||||
useMemo,
|
useMemo,
|
||||||
useEffect,
|
useEffect,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { ActivityIndicator, Platform, RefreshControl } from 'react-native';
|
import { ActivityIndicator, Platform, RefreshControl, Text } from 'react-native';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { FlatList } from 'react-native-gesture-handler';
|
import { FlatList } from 'react-native-gesture-handler';
|
||||||
@ -24,6 +24,7 @@ import { deleteComment } from '../../../providers/hive/dhive';
|
|||||||
import { updateCommentCache } from '../../../redux/actions/cacheActions';
|
import { updateCommentCache } from '../../../redux/actions/cacheActions';
|
||||||
import { CommentCacheStatus } from '../../../redux/reducers/cacheReducer';
|
import { CommentCacheStatus } from '../../../redux/reducers/cacheReducer';
|
||||||
import { CommentsSection } from '../children/commentsSection';
|
import { CommentsSection } from '../children/commentsSection';
|
||||||
|
import styles from '../children/postComments.styles';
|
||||||
|
|
||||||
|
|
||||||
const PostComments = forwardRef(
|
const PostComments = forwardRef(
|
||||||
@ -36,6 +37,7 @@ const PostComments = forwardRef(
|
|||||||
isLoading,
|
isLoading,
|
||||||
onRefresh,
|
onRefresh,
|
||||||
handleOnCommentsLoaded,
|
handleOnCommentsLoaded,
|
||||||
|
handleOnReplyPress
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
@ -242,10 +244,22 @@ const PostComments = forwardRef(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const _listEmptyComponent = () => {
|
const _renderEmptyContent = () => {
|
||||||
return <ActivityIndicator />
|
if (discussionQuery.isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const _onPress = () => {
|
||||||
|
if (handleOnReplyPress) {
|
||||||
|
handleOnReplyPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Text onPress={_onPress} style={styles.emptyText}>
|
||||||
|
{intl.formatMessage({ id: 'comments.no_comments' })}
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const _renderItem = ({ item, index }) => {
|
const _renderItem = ({ item, index }) => {
|
||||||
return <CommentsSection
|
return <CommentsSection
|
||||||
@ -265,10 +279,9 @@ const PostComments = forwardRef(
|
|||||||
return (
|
return (
|
||||||
<FlatList
|
<FlatList
|
||||||
ref={commentsListRef}
|
ref={commentsListRef}
|
||||||
style={{ flex: 1 }}
|
style={styles.list}
|
||||||
contentContainerStyle={{ marginBottom: 200 }}
|
|
||||||
ListHeaderComponent={_postContentView}
|
ListHeaderComponent={_postContentView}
|
||||||
ListEmptyComponent={_listEmptyComponent}
|
ListEmptyComponent={_renderEmptyContent}
|
||||||
data={shouldRenderComments ? sortedSections : []}
|
data={shouldRenderComments ? sortedSections : []}
|
||||||
onContentSizeChange={_onContentSizeChange}
|
onContentSizeChange={_onContentSizeChange}
|
||||||
renderItem={_renderItem}
|
renderItem={_renderItem}
|
||||||
|
Loading…
Reference in New Issue
Block a user