mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-17 10:21:33 +03:00
lint
This commit is contained in:
parent
a8979f5b74
commit
dffd5bcd52
@ -47,7 +47,7 @@ class NotificationView extends PureComponent {
|
||||
// Component Functions
|
||||
|
||||
_handleOnDropdownSelect = async (index) => {
|
||||
const { changeSelectedFilter, } = this.props;
|
||||
const { changeSelectedFilter } = this.props;
|
||||
const { filters, contentOffset } = this.state;
|
||||
|
||||
const _selectedFilter = filters[index].key;
|
||||
@ -175,34 +175,40 @@ class NotificationView extends PureComponent {
|
||||
return 5;
|
||||
};
|
||||
|
||||
|
||||
_getActivityIndicator = () => (
|
||||
<View style={styles.loading}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
|
||||
|
||||
_renderSectionHeader = ({ section: { title, index } }) => (
|
||||
<ContainerHeader hasSeperator={index !== 0} isBoldTitle title={title} key={title} />
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
_renderItem = ({ item }) => (
|
||||
<>
|
||||
{item.sectionTitle && <ContainerHeader hasSeperator={!item.firstSection} isBoldTitle title={item.sectionTitle} />}
|
||||
{item.sectionTitle && (
|
||||
<ContainerHeader hasSeperator={!item.firstSection} isBoldTitle title={item.sectionTitle} />
|
||||
)}
|
||||
<NotificationLine
|
||||
notification={item}
|
||||
handleOnPressNotification={this.props.navigateToNotificationRoute}
|
||||
handleOnUserPress={() => { this.props.handleOnUserPress(item.source) }}
|
||||
handleOnUserPress={() => {
|
||||
this.props.handleOnUserPress(item.source);
|
||||
}}
|
||||
globalProps={this.props.globalProps}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
render() {
|
||||
const { readAllNotification, getActivities, isNotificationRefreshing, intl, isLoading } = this.props;
|
||||
const {
|
||||
readAllNotification,
|
||||
getActivities,
|
||||
isNotificationRefreshing,
|
||||
intl,
|
||||
isLoading,
|
||||
} = this.props;
|
||||
const { filters, selectedFilter, selectedIndex } = this.state;
|
||||
const _notifications = this._getNotificationsArrays();
|
||||
|
||||
@ -221,8 +227,7 @@ class NotificationView extends PureComponent {
|
||||
onRightIconPress={readAllNotification}
|
||||
/>
|
||||
<ThemeContainer>
|
||||
{({ isDarkTheme }) =>
|
||||
|
||||
{({ isDarkTheme }) => (
|
||||
<FlatList
|
||||
ref={this.listRef}
|
||||
data={_notifications}
|
||||
@ -231,12 +236,14 @@ class NotificationView extends PureComponent {
|
||||
onEndReachedThreshold={0.3}
|
||||
ListFooterComponent={this._renderFooterLoading}
|
||||
ListEmptyComponent={
|
||||
isNotificationRefreshing ? <ListPlaceHolder/> : (
|
||||
<Text style={globalStyles.hintText}>
|
||||
{intl.formatMessage({ id: 'notification.noactivity' })}
|
||||
</Text>
|
||||
isNotificationRefreshing ? (
|
||||
<ListPlaceHolder />
|
||||
) : (
|
||||
<Text style={globalStyles.hintText}>
|
||||
{intl.formatMessage({ id: 'notification.noactivity' })}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
}
|
||||
contentContainerStyle={styles.listContentContainer}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
@ -250,8 +257,7 @@ class NotificationView extends PureComponent {
|
||||
}
|
||||
renderItem={this._renderItem}
|
||||
/>
|
||||
|
||||
}
|
||||
)}
|
||||
</ThemeContainer>
|
||||
</View>
|
||||
);
|
||||
|
@ -6,7 +6,6 @@ import QUERIES from './queryKeys';
|
||||
export const useNotificationsQuery = (filter: NotificationFilters) => {
|
||||
const _fetchLimit = 20;
|
||||
|
||||
|
||||
return useInfiniteQuery<any[]>(
|
||||
[QUERIES.NOTIFICATIONS.GET, filter],
|
||||
async ({ pageParam }) => {
|
||||
@ -21,7 +20,8 @@ export const useNotificationsQuery = (filter: NotificationFilters) => {
|
||||
pages: [],
|
||||
},
|
||||
getNextPageParam: (lastPage) => {
|
||||
const lastId = lastPage && lastPage.length === _fetchLimit ? lastPage.lastItem.id : undefined;
|
||||
const lastId =
|
||||
lastPage && lastPage.length === _fetchLimit ? lastPage.lastItem.id : undefined;
|
||||
console.log('extracting next page parameter', lastId);
|
||||
return lastId;
|
||||
},
|
||||
|
@ -44,23 +44,18 @@ const NotificationContainer = ({ navigation }) => {
|
||||
|
||||
const notificationsQuery = useNotificationsQuery(selectedFilter);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
queryClient.removeQueries([QUERIES.NOTIFICATIONS.GET])
|
||||
queryClient.removeQueries([QUERIES.NOTIFICATIONS.GET]);
|
||||
notificationsQuery.refetch();
|
||||
curUsername.current = currentAccount.useranme
|
||||
|
||||
curUsername.current = currentAccount.useranme;
|
||||
}, [currentAccount.username]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (currentAccount.unread_activity_count < unreadCountRef.current) {
|
||||
queryClient.invalidateQueries([QUERIES.NOTIFICATIONS.GET]);
|
||||
}
|
||||
unreadCountRef.current = currentAccount.unread_activity_count
|
||||
}, [currentAccount.unread_activity_count])
|
||||
|
||||
|
||||
unreadCountRef.current = currentAccount.unread_activity_count;
|
||||
}, [currentAccount.unread_activity_count]);
|
||||
|
||||
const _getActivities = (loadMore = false) => {
|
||||
if (loadMore) {
|
||||
@ -166,8 +161,8 @@ const NotificationContainer = ({ navigation }) => {
|
||||
setSelectedFilter(value);
|
||||
};
|
||||
|
||||
console.log("query data: ", notificationsQuery.data)
|
||||
const _notifications = notificationsQuery.data?.pages?.flatMap(page => page);
|
||||
console.log('query data: ', notificationsQuery.data);
|
||||
const _notifications = notificationsQuery.data?.pages?.flatMap((page) => page);
|
||||
|
||||
return (
|
||||
<NotificationScreen
|
||||
|
Loading…
Reference in New Issue
Block a user