Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/CustomTabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ const createStyles = (theme: Theme) =>
flexDirection: 'row',
height: theme.ui.tabViewHeight,
alignItems: 'center',
borderBottomWidth: 1,
borderBottomColor: theme.colors.border,
},
tabItem: {
justifyContent: 'center',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
},
"notifications": {
"title": "الإشعارات",
"emptyState": "لا يوجد شيء هنا — بعد",
"tabs": {
"all": "الكل",
"mentions": "الإشارات"
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
},
"notifications": {
"title": "Notifications",
"emptyState": "Nothing to see here — yet",
"tabs": {
"all": "All",
"mentions": "Mentions"
Expand Down Expand Up @@ -457,7 +458,7 @@
"tabs": {
"reposts": "Reposts",
"quotes": "Quotes",
"likers": "Likers"
"likers": "Liked by"
}
},
"tweetSummary": {
Expand Down
22 changes: 21 additions & 1 deletion src/modules/notifications/components/NotificationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Theme } from '@/src/constants/theme';
import { useTheme } from '@/src/context/ThemeContext';
import { FlashList } from '@shopify/flash-list';
import { useMemo, useRef } from 'react';
import { ActivityIndicator, RefreshControl, StyleSheet, View } from 'react-native';
import { useTranslation } from 'react-i18next';
import { ActivityIndicator, RefreshControl, StyleSheet, Text, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import NotificationContainer from '../containers/NotificationContainer';
import { INotification } from '../types';
Expand Down Expand Up @@ -34,6 +35,7 @@ const NotificationsList: React.FC<INotificationsListProps> = (props) => {
useCustomRefreshIndicator = false,
} = props;
const { theme } = useTheme();
const { t } = useTranslation();
const insets = useSafeAreaInsets();
const styles = useMemo(() => createStyles(theme), [theme]);

Expand Down Expand Up @@ -76,6 +78,12 @@ const NotificationsList: React.FC<INotificationsListProps> = (props) => {
);
};

const renderEmpty = () => (
<View style={styles.emptyState} testID="notifications_empty_state">
<Text style={styles.emptyText}>{t('notifications.emptyState')}</Text>
</View>
);

if (isLoading) {
return (
<View style={styles.loadingContainer} accessibilityLabel="notifications_loading" testID="notifications_loading">
Expand Down Expand Up @@ -106,6 +114,7 @@ const NotificationsList: React.FC<INotificationsListProps> = (props) => {
testID="notifications_list_feed"
ListHeaderComponent={renderHeader}
ListFooterComponent={renderFooter}
ListEmptyComponent={renderEmpty}
onEndReached={onEndReached}
onEndReachedThreshold={onEndReachedThreshold ?? 0.5}
removeClippedSubviews={false}
Expand Down Expand Up @@ -138,6 +147,17 @@ const createStyles = (theme: Theme) =>
justifyContent: 'center',
width: '100%',
},
emptyState: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 40,
},
emptyText: {
color: theme.colors.text.secondary,
fontSize: theme.typography.sizes.md,
fontFamily: theme.typography.fonts.regular,
},
list: {
flex: 1,
},
Expand Down
Loading