dhre-ui-kit 0.0.51 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -17,6 +17,7 @@ interface ContactModalProps {
17
17
  visible: boolean;
18
18
  onClose: () => void;
19
19
  isMailOpen: boolean;
20
+ data: string;
20
21
  }
21
22
 
22
23
  const ContactModal: React.FC<ContactModalProps> = ({
@@ -24,6 +25,7 @@ const ContactModal: React.FC<ContactModalProps> = ({
24
25
  visible,
25
26
  onClose,
26
27
  isMailOpen,
28
+ data,
27
29
  }) => {
28
30
  const handleCall = () => {
29
31
  if (Platform.OS === 'ios') {
@@ -33,9 +35,46 @@ const ContactModal: React.FC<ContactModalProps> = ({
33
35
  }
34
36
  onClose();
35
37
  };
38
+ const openEmail = (recipient: string) => {
39
+ const mailtoUrl = `mailto:${recipient}?subject=${encodeURIComponent(
40
+ '',
41
+ )}&body=${encodeURIComponent('')}`;
36
42
 
37
- const handleOptionPress = (appName: string) => {
38
- console.log(`Opening ${appName}`);
43
+ if (Platform.OS === 'android') {
44
+ // Try to open Gmail specifically on Android
45
+ const gmailUrl = `intent://#Intent;scheme=mailto;package=com.google.android.gm;S.to=${recipient};S.subject=${encodeURIComponent(
46
+ '',
47
+ )};S.body=${encodeURIComponent('')};end`;
48
+
49
+ // Check if Gmail can be opened
50
+ Linking.canOpenURL(gmailUrl)
51
+ .then(supported => {
52
+ if (supported) {
53
+ // Open Gmail
54
+ return Linking.openURL(gmailUrl);
55
+ } else {
56
+ // If Gmail is not available, fallback to default mail client
57
+ console.log('Gmail app not available, opening default mail app');
58
+ return Linking.openURL(mailtoUrl);
59
+ }
60
+ })
61
+ .catch(err => console.error('Error:', err));
62
+ } else {
63
+ // iOS: Use mailto URL to open the default email client
64
+ Linking.canOpenURL(mailtoUrl)
65
+ .then(supported => {
66
+ if (!supported) {
67
+ console.log('No email client available');
68
+ } else {
69
+ return Linking.openURL(mailtoUrl);
70
+ }
71
+ })
72
+ .catch(err => console.error('Error:', err));
73
+ }
74
+ };
75
+
76
+ const handleOptionPress = () => {
77
+ openEmail(data);
39
78
  onClose();
40
79
  };
41
80
 
@@ -56,7 +95,7 @@ const ContactModal: React.FC<ContactModalProps> = ({
56
95
  <React.Fragment key={option}>
57
96
  <Line />
58
97
  <Pressable
59
- onPress={() => handleOptionPress(option)}
98
+ onPress={() => handleOptionPress()}
60
99
  style={styles.optionButton}>
61
100
  <CustomText
62
101
  style={styles.optionText}
@@ -171,6 +171,7 @@ export const DHRE_DEFAULT = {
171
171
  DH_ERROR: '#EB382D',
172
172
  DH_INFO: '#339ECF',
173
173
  DH_SEMENTIC_ERROR: '#EB0542',
174
+ DH_SEMENTIC_WARNING: '#EB8425',
174
175
  };
175
176
 
176
177
  export const DHRE_COLORS_TEXT = {