diff options
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/chat/ChatListScreen.tsx | 4 | ||||
| -rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 4 | ||||
| -rw-r--r-- | src/screens/main/notification/EmptyNotificationView.tsx | 129 |
3 files changed, 4 insertions, 133 deletions
diff --git a/src/screens/chat/ChatListScreen.tsx b/src/screens/chat/ChatListScreen.tsx index 810ebdb2..1df5c2da 100644 --- a/src/screens/chat/ChatListScreen.tsx +++ b/src/screens/chat/ChatListScreen.tsx @@ -9,7 +9,7 @@ import {TabsGradient} from '../../components'; import {ChannelPreview, MessagesHeader} from '../../components/messages'; import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootReducer'; -import EmptyNotificationView from '../../screens/main/notification/EmptyNotificationView'; +import EmptyContentView from '../../components/common/EmptyContentView'; import { LocalAttachmentType, LocalChannelType, @@ -101,7 +101,7 @@ const ChatListScreen: React.FC<ChatListScreenProps> = () => { maxUnreadCount={99} Preview={ChannelPreview} EmptyStateIndicator={() => { - return <EmptyNotificationView viewType={'ChatList'} />; + return <EmptyContentView viewType={'ChatList'} />; }} /> </View> diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 06a61f04..9fbc4cfe 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -28,7 +28,7 @@ import { import {RootState} from '../../store/rootReducer'; import {NotificationType, ScreenType} from '../../types'; import {getDateAge, normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; -import EmptyNotificationView from './notification/EmptyNotificationView'; +import EmptyContentView from '../../components/common/EmptyContentView'; const NotificationsScreen: React.FC = () => { const {newNotificationReceived} = useSelector( @@ -304,7 +304,7 @@ const NotificationsScreen: React.FC = () => { extraData={requestLimit} ListEmptyComponent={ <View style={styles.emptyViewContainer}> - <EmptyNotificationView viewType={'Notification'} /> + <EmptyContentView viewType={'Notification'} /> </View> } /> diff --git a/src/screens/main/notification/EmptyNotificationView.tsx b/src/screens/main/notification/EmptyNotificationView.tsx deleted file mode 100644 index b80bb203..00000000 --- a/src/screens/main/notification/EmptyNotificationView.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import React from 'react'; -import {Image, Text, StyleSheet, View} from 'react-native'; -import LinearGradient from 'react-native-linear-gradient'; -import { - UP_TO_DATE, - NO_NEW_NOTIFICATIONS, - FIRST_MESSAGE, - START_CHATTING, -} from '../../../constants/strings'; -import {NOTIFICATION_GRADIENT} from '../../../constants/constants'; -import {SCREEN_HEIGHT, normalize, SCREEN_WIDTH} from '../../../utils'; -import {EmptyViewProps} from '../../../types/index'; - -const EmptyNotificationView: React.FC<EmptyViewProps> = ({viewType}) => { - const _getNotificationImage = () => { - return ( - <LinearGradient - style={styles.backgroundLinearView} - useAngle={true} - angle={180} - colors={NOTIFICATION_GRADIENT}> - <Image - source={require('../../../assets/images/empty_notifications.png')} - /> - </LinearGradient> - ); - }; - - const _getChatImage = () => { - return ( - <LinearGradient - style={styles.backgroundLinearView} - useAngle={true} - angle={180} - colors={NOTIFICATION_GRADIENT}> - <Image - style={styles.imageStyles} - source={require('../../../assets/images/no_chats.png')} - /> - </LinearGradient> - ); - }; - - const _getImageForType = () => { - switch (viewType) { - case 'Notification': - return _getNotificationImage(); - case 'ChatList': - return _getChatImage(); - } - }; - - const _getTextForNotification = () => { - return ( - <> - <View style={styles.topMargin}> - <Text style={styles.upperTextStyle}>{UP_TO_DATE}</Text> - </View> - <View> - <Text style={styles.bottomTextStyle}>{NO_NEW_NOTIFICATIONS}</Text> - </View> - </> - ); - }; - - const _getTextForChat = () => { - return ( - <View style={styles.chatTextStyles}> - <View style={styles.topMargin}> - <Text style={styles.upperTextStyle}>{START_CHATTING}</Text> - </View> - <View> - <Text style={styles.bottomTextStyle}>{FIRST_MESSAGE}</Text> - </View> - </View> - ); - }; - - const _getTextForType = () => { - switch (viewType) { - case 'Notification': - return _getTextForNotification(); - case 'ChatList': - return _getTextForChat(); - } - }; - - return ( - <View style={styles.container}> - {_getImageForType()} - {_getTextForType()} - </View> - ); -}; - -const styles = StyleSheet.create({ - container: { - flex: 1, - flexDirection: 'column', - justifyContent: 'center', - alignItems: 'center', - }, - topMargin: {marginTop: SCREEN_HEIGHT * 0.025}, - upperTextStyle: { - textAlign: 'center', - fontWeight: '700', - fontSize: normalize(23), - lineHeight: normalize(40), - }, - chatTextStyles: { - width: '85%', - }, - bottomTextStyle: { - textAlign: 'center', - color: '#2D3B45', - fontWeight: '600', - fontSize: normalize(20), - lineHeight: normalize(40), - }, - imageStyles: { - width: SCREEN_WIDTH * 0.72, - height: SCREEN_WIDTH * 0.72, - }, - backgroundLinearView: { - borderRadius: (SCREEN_WIDTH * 0.72) / 2, - }, -}); - -export default EmptyNotificationView; |
