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
|
import * as React from 'react';
import {StyleSheet, Text, TouchableOpacity} from 'react-native';
import {Image, View} from 'react-native-animatable';
import CloseIcon from '../../assets/ionicons/close-outline.svg';
import {isIPhoneX, normalize, SCREEN_HEIGHT} from '../../utils';
type TaggPromptProps = {
messageHeader: string;
messageBody: string | Element;
logoType: 'plus' | 'tagg' | 'invite_friends' | 'private_accounts';
hideCloseButton?: boolean;
noPadding?: boolean;
onClose: () => void;
};
const TaggPrompt: React.FC<TaggPromptProps> = ({
messageHeader,
messageBody,
logoType,
hideCloseButton,
noPadding,
onClose,
}) => {
/**
* Generic prompt for Tagg
*/
const logo = () => {
switch (logoType) {
case 'plus':
return require('../../assets/icons/notificationPrompts/plus-logo.png');
case 'invite_friends':
return require('../../assets/icons/notificationPrompts/invite-friends-prompt-icon.png');
case 'private_accounts':
return require('../../assets/icons/notificationPrompts/private-accounts-prompt-icon.png');
case 'tagg':
default:
return require('../../assets/images/logo-purple.png');
}
};
return (
<View
style={[
styles.container,
{paddingTop: noPadding ? 0 : SCREEN_HEIGHT / 10},
{paddingBottom: noPadding ? 0 : SCREEN_HEIGHT / 50},
]}>
<Image style={styles.icon} source={logo()} />
<Text style={styles.header}>{messageHeader}</Text>
<Text style={styles.subtext}>{messageBody}</Text>
{!hideCloseButton && (
<TouchableOpacity
style={styles.closeButton}
onPress={() => {
onClose();
}}>
<CloseIcon height={'50%'} width={'50%'} color="gray" />
</TouchableOpacity>
)}
</View>
);
};
const styles = StyleSheet.create({
container: {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
height: SCREEN_HEIGHT / 4,
},
closeButton: {
position: 'relative',
height: '40%',
bottom: SCREEN_HEIGHT / 6,
aspectRatio: 1,
alignSelf: 'flex-end',
},
icon: {
width: normalize(40),
height: normalize(40),
},
header: {
color: 'black',
fontSize: normalize(16),
fontWeight: '600',
textAlign: 'center',
marginTop: '2%',
},
subtext: {
color: 'gray',
fontSize: normalize(12),
fontWeight: '500',
lineHeight: normalize(20),
textAlign: 'center',
marginTop: '2%',
width: '95%',
},
});
export default TaggPrompt;
|