dhre-ui-kit 0.0.13 → 0.0.14
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
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Pressable,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Modal,
|
|
7
|
+
Linking,
|
|
8
|
+
Platform,
|
|
9
|
+
Alert,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import CustomText from '../customText';
|
|
12
|
+
import Line from '../horizontalLine/Line';
|
|
13
|
+
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
14
|
+
|
|
15
|
+
interface ContactModalProps {
|
|
16
|
+
phoneNumber: string;
|
|
17
|
+
visible: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
isMailOpen: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ContactModal: React.FC<ContactModalProps> = ({
|
|
23
|
+
phoneNumber,
|
|
24
|
+
visible,
|
|
25
|
+
onClose,
|
|
26
|
+
isMailOpen,
|
|
27
|
+
}) => {
|
|
28
|
+
const handleCall = () => {
|
|
29
|
+
if (Platform.OS === 'ios') {
|
|
30
|
+
Alert.alert('Phone calls are not supported on the iOS simulator.');
|
|
31
|
+
} else {
|
|
32
|
+
Linking.openURL(`tel:${phoneNumber}`);
|
|
33
|
+
}
|
|
34
|
+
onClose();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleOptionPress = (appName: string) => {
|
|
38
|
+
console.log(`Opening ${appName}`);
|
|
39
|
+
onClose();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const emailOptions = ['Mail', 'Gmail', 'Outlook'];
|
|
43
|
+
const renderEmailOptions = () => (
|
|
44
|
+
<>
|
|
45
|
+
<CustomText
|
|
46
|
+
style={styles.title}
|
|
47
|
+
text="Open email app"
|
|
48
|
+
variant="L2_REGULAR"
|
|
49
|
+
/>
|
|
50
|
+
<CustomText
|
|
51
|
+
style={styles.subtitle}
|
|
52
|
+
text="Which app would you like to open?"
|
|
53
|
+
variant="L2_REGULAR"
|
|
54
|
+
/>
|
|
55
|
+
{emailOptions.map(option => (
|
|
56
|
+
<React.Fragment key={option}>
|
|
57
|
+
<Line />
|
|
58
|
+
<Pressable
|
|
59
|
+
onPress={() => handleOptionPress(option)}
|
|
60
|
+
style={styles.optionButton}>
|
|
61
|
+
<CustomText
|
|
62
|
+
style={styles.optionText}
|
|
63
|
+
text={option}
|
|
64
|
+
variant="B3_BOLD"
|
|
65
|
+
/>
|
|
66
|
+
</Pressable>
|
|
67
|
+
</React.Fragment>
|
|
68
|
+
))}
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const renderContent = () => (
|
|
73
|
+
<>
|
|
74
|
+
<View style={styles.viewContainer}>
|
|
75
|
+
{isMailOpen ? (
|
|
76
|
+
renderEmailOptions()
|
|
77
|
+
) : (
|
|
78
|
+
<Pressable onPress={handleCall} style={styles.optionButton}>
|
|
79
|
+
<CustomText
|
|
80
|
+
style={styles.optionText}
|
|
81
|
+
text={`Call ${phoneNumber}`}
|
|
82
|
+
variant="B3_BOLD"
|
|
83
|
+
/>
|
|
84
|
+
</Pressable>
|
|
85
|
+
)}
|
|
86
|
+
</View>
|
|
87
|
+
<Pressable onPress={onClose} style={styles.cancelButton}>
|
|
88
|
+
<CustomText
|
|
89
|
+
style={styles.cancelText}
|
|
90
|
+
text="Cancel"
|
|
91
|
+
variant="B2_REGULAR"
|
|
92
|
+
/>
|
|
93
|
+
</Pressable>
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<View style={styles.container}>
|
|
99
|
+
<Modal
|
|
100
|
+
animationType="slide"
|
|
101
|
+
transparent
|
|
102
|
+
visible={visible}
|
|
103
|
+
onRequestClose={onClose}>
|
|
104
|
+
<View style={styles.modalContainer}>
|
|
105
|
+
<View style={styles.modalContent}>{renderContent()}</View>
|
|
106
|
+
</View>
|
|
107
|
+
</Modal>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const styles = StyleSheet.create({
|
|
113
|
+
container: {
|
|
114
|
+
flex: 1,
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
117
|
+
},
|
|
118
|
+
modalContainer: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
justifyContent: 'flex-end',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
backgroundColor: 'rgba(0, 0, 0, .7)',
|
|
123
|
+
},
|
|
124
|
+
modalContent: {
|
|
125
|
+
padding: 20,
|
|
126
|
+
width: '100%',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
marginHorizontal: 20,
|
|
129
|
+
borderRadius: 10,
|
|
130
|
+
},
|
|
131
|
+
viewContainer: {
|
|
132
|
+
width: '100%',
|
|
133
|
+
backgroundColor: '#1C1C1E',
|
|
134
|
+
borderRadius: 10,
|
|
135
|
+
},
|
|
136
|
+
cancelText: {
|
|
137
|
+
color: '#007AFF',
|
|
138
|
+
},
|
|
139
|
+
title: {
|
|
140
|
+
textAlign: 'center',
|
|
141
|
+
marginTop: 13,
|
|
142
|
+
},
|
|
143
|
+
subtitle: {
|
|
144
|
+
textAlign: 'center',
|
|
145
|
+
marginTop: 2,
|
|
146
|
+
marginBottom: 13,
|
|
147
|
+
},
|
|
148
|
+
optionButton: {
|
|
149
|
+
padding: 16,
|
|
150
|
+
borderRadius: 8,
|
|
151
|
+
alignItems: 'center',
|
|
152
|
+
},
|
|
153
|
+
optionText: {
|
|
154
|
+
fontSize: 16,
|
|
155
|
+
color: '#007AFF',
|
|
156
|
+
},
|
|
157
|
+
cancelButton: {
|
|
158
|
+
marginTop: 10,
|
|
159
|
+
paddingVertical: 15,
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
borderRadius: 8,
|
|
162
|
+
backgroundColor: '#1C1C1E',
|
|
163
|
+
width: '100%',
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export default withThemeProvider(ContactModal);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './ContactModel';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {View, StyleSheet, ViewStyle} from 'react-native';
|
|
3
3
|
import {useTheme} from '../../theme/ThemeContext';
|
|
4
|
+
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
4
5
|
|
|
5
6
|
const HorizontalLine = ({style}: {style?: ViewStyle}) => {
|
|
6
7
|
const {theme} = useTheme();
|
|
@@ -22,4 +23,4 @@ const styles = StyleSheet.create({
|
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
export default HorizontalLine;
|
|
26
|
+
export default withThemeProvider(HorizontalLine);
|
|
@@ -3,6 +3,7 @@ import {TouchableOpacity, View, StyleSheet, ViewStyle} from 'react-native';
|
|
|
3
3
|
import {SvgProps} from 'react-native-svg';
|
|
4
4
|
import {useTheme} from '../../theme/ThemeContext';
|
|
5
5
|
import CustomText from '../customText';
|
|
6
|
+
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
6
7
|
|
|
7
8
|
interface OurOfficesButtonProps {
|
|
8
9
|
rightIcon?: ReactElement<SvgProps>;
|
|
@@ -81,4 +82,4 @@ const styles = StyleSheet.create({
|
|
|
81
82
|
},
|
|
82
83
|
});
|
|
83
84
|
|
|
84
|
-
export default Topic;
|
|
85
|
+
export default withThemeProvider(Topic);
|
package/src/index.ts
CHANGED
|
@@ -27,5 +27,6 @@ export {default as CustomIcon} from './components/customIcon';
|
|
|
27
27
|
export {default as CustomLoader} from './components/customLoader';
|
|
28
28
|
export {default as Line} from './components/horizontalLine';
|
|
29
29
|
export {default as Topic} from './components/topic';
|
|
30
|
+
export {default as ContactModel} from './components/ContactModel';
|
|
30
31
|
|
|
31
32
|
export * from './utils/stylehelper';
|