1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
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 EmptyContentView: 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 EmptyContentView;
|