@developer_tribe/react-native-comnyx 0.3.2 → 0.3.4

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.
Files changed (179) hide show
  1. package/lib/commonjs/App.js +8 -3
  2. package/lib/commonjs/App.js.map +1 -1
  3. package/lib/commonjs/assets/arrow-right.png +0 -0
  4. package/lib/commonjs/assets/headphones-01.png +0 -0
  5. package/lib/commonjs/assets/iconamoon_clock-fill.png +0 -0
  6. package/lib/commonjs/assets/info-circle.png +0 -0
  7. package/lib/commonjs/assets/message-notification-square.png +0 -0
  8. package/lib/commonjs/assets/x-close.png +0 -0
  9. package/lib/commonjs/components/ChatList.js +356 -50
  10. package/lib/commonjs/components/ChatList.js.map +1 -1
  11. package/lib/commonjs/components/CustomAlert.js +132 -0
  12. package/lib/commonjs/components/CustomAlert.js.map +1 -0
  13. package/lib/commonjs/components/CustomerForm.js +252 -198
  14. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  15. package/lib/commonjs/components/EmptyList.js +36 -11
  16. package/lib/commonjs/components/EmptyList.js.map +1 -1
  17. package/lib/commonjs/components/InitFailed.js +8 -5
  18. package/lib/commonjs/components/InitFailed.js.map +1 -1
  19. package/lib/commonjs/components/MessageInput.js +49 -16
  20. package/lib/commonjs/components/MessageInput.js.map +1 -1
  21. package/lib/commonjs/components/MessageItem.js +133 -42
  22. package/lib/commonjs/components/MessageItem.js.map +1 -1
  23. package/lib/commonjs/components/ScaledSheet.js +67 -0
  24. package/lib/commonjs/components/ScaledSheet.js.map +1 -0
  25. package/lib/commonjs/components/SizeMatter.js +27 -0
  26. package/lib/commonjs/components/SizeMatter.js.map +1 -0
  27. package/lib/commonjs/index.js +7 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/store.js +15 -9
  30. package/lib/commonjs/store.js.map +1 -1
  31. package/lib/commonjs/types/Theme.js +20 -2
  32. package/lib/commonjs/types/Theme.js.map +1 -1
  33. package/lib/commonjs/utils/deepMap.js +38 -0
  34. package/lib/commonjs/utils/deepMap.js.map +1 -0
  35. package/lib/commonjs/utils/formatDate.js +20 -0
  36. package/lib/commonjs/utils/formatDate.js.map +1 -0
  37. package/lib/commonjs/utils/scalingUtils.js +33 -0
  38. package/lib/commonjs/utils/scalingUtils.js.map +1 -0
  39. package/lib/commonjs/viewabilityConfig.js +11 -0
  40. package/lib/commonjs/viewabilityConfig.js.map +1 -0
  41. package/lib/module/App.js +8 -3
  42. package/lib/module/App.js.map +1 -1
  43. package/lib/module/assets/arrow-right.png +0 -0
  44. package/lib/module/assets/headphones-01.png +0 -0
  45. package/lib/module/assets/iconamoon_clock-fill.png +0 -0
  46. package/lib/module/assets/info-circle.png +0 -0
  47. package/lib/module/assets/message-notification-square.png +0 -0
  48. package/lib/module/assets/x-close.png +0 -0
  49. package/lib/module/components/ChatList.js +358 -54
  50. package/lib/module/components/ChatList.js.map +1 -1
  51. package/lib/module/components/CustomAlert.js +127 -0
  52. package/lib/module/components/CustomAlert.js.map +1 -0
  53. package/lib/module/components/CustomerForm.js +253 -200
  54. package/lib/module/components/CustomerForm.js.map +1 -1
  55. package/lib/module/components/EmptyList.js +38 -13
  56. package/lib/module/components/EmptyList.js.map +1 -1
  57. package/lib/module/components/InitFailed.js +9 -6
  58. package/lib/module/components/InitFailed.js.map +1 -1
  59. package/lib/module/components/MessageInput.js +50 -17
  60. package/lib/module/components/MessageInput.js.map +1 -1
  61. package/lib/module/components/MessageItem.js +134 -44
  62. package/lib/module/components/MessageItem.js.map +1 -1
  63. package/lib/module/components/ScaledSheet.js +62 -0
  64. package/lib/module/components/ScaledSheet.js.map +1 -0
  65. package/lib/module/components/SizeMatter.js +23 -0
  66. package/lib/module/components/SizeMatter.js.map +1 -0
  67. package/lib/module/index.js +1 -0
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/store.js +15 -9
  70. package/lib/module/store.js.map +1 -1
  71. package/lib/module/types/Theme.js +20 -2
  72. package/lib/module/types/Theme.js.map +1 -1
  73. package/lib/module/utils/deepMap.js +34 -0
  74. package/lib/module/utils/deepMap.js.map +1 -0
  75. package/lib/module/utils/formatDate.js +15 -0
  76. package/lib/module/utils/formatDate.js.map +1 -0
  77. package/lib/module/utils/scalingUtils.js +25 -0
  78. package/lib/module/utils/scalingUtils.js.map +1 -0
  79. package/lib/module/viewabilityConfig.js +7 -0
  80. package/lib/module/viewabilityConfig.js.map +1 -0
  81. package/lib/typescript/commonjs/src/App.d.ts +2 -1
  82. package/lib/typescript/commonjs/src/App.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/src/components/ChatList.d.ts +3 -1
  84. package/lib/typescript/commonjs/src/components/ChatList.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/components/CustomAlert.d.ts +15 -0
  86. package/lib/typescript/commonjs/src/components/CustomAlert.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts +3 -1
  88. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/src/components/EmptyList.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/src/components/InitFailed.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/src/components/MessageInput.d.ts +1 -0
  92. package/lib/typescript/commonjs/src/components/MessageInput.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/src/components/MessageItem.d.ts +2 -1
  94. package/lib/typescript/commonjs/src/components/MessageItem.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/src/components/ScaledSheet.d.ts +2 -0
  96. package/lib/typescript/commonjs/src/components/ScaledSheet.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/src/components/SizeMatter.d.ts +7 -0
  98. package/lib/typescript/commonjs/src/components/SizeMatter.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  100. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/store.d.ts +6 -0
  102. package/lib/typescript/commonjs/src/store.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/types/Conversation.d.ts +2 -0
  104. package/lib/typescript/commonjs/src/types/Conversation.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/types/Theme.d.ts +9 -0
  106. package/lib/typescript/commonjs/src/types/Theme.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/utils/deepMap.d.ts +7 -0
  108. package/lib/typescript/commonjs/src/utils/deepMap.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/utils/formatDate.d.ts +2 -0
  110. package/lib/typescript/commonjs/src/utils/formatDate.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/utils/scalingUtils.d.ts +10 -0
  112. package/lib/typescript/commonjs/src/utils/scalingUtils.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/viewabilityConfig.d.ts +5 -0
  114. package/lib/typescript/commonjs/src/viewabilityConfig.d.ts.map +1 -0
  115. package/lib/typescript/module/src/App.d.ts +2 -1
  116. package/lib/typescript/module/src/App.d.ts.map +1 -1
  117. package/lib/typescript/module/src/components/ChatList.d.ts +3 -1
  118. package/lib/typescript/module/src/components/ChatList.d.ts.map +1 -1
  119. package/lib/typescript/module/src/components/CustomAlert.d.ts +15 -0
  120. package/lib/typescript/module/src/components/CustomAlert.d.ts.map +1 -0
  121. package/lib/typescript/module/src/components/CustomerForm.d.ts +3 -1
  122. package/lib/typescript/module/src/components/CustomerForm.d.ts.map +1 -1
  123. package/lib/typescript/module/src/components/EmptyList.d.ts.map +1 -1
  124. package/lib/typescript/module/src/components/InitFailed.d.ts.map +1 -1
  125. package/lib/typescript/module/src/components/MessageInput.d.ts +1 -0
  126. package/lib/typescript/module/src/components/MessageInput.d.ts.map +1 -1
  127. package/lib/typescript/module/src/components/MessageItem.d.ts +2 -1
  128. package/lib/typescript/module/src/components/MessageItem.d.ts.map +1 -1
  129. package/lib/typescript/module/src/components/ScaledSheet.d.ts +2 -0
  130. package/lib/typescript/module/src/components/ScaledSheet.d.ts.map +1 -0
  131. package/lib/typescript/module/src/components/SizeMatter.d.ts +7 -0
  132. package/lib/typescript/module/src/components/SizeMatter.d.ts.map +1 -0
  133. package/lib/typescript/module/src/index.d.ts +1 -0
  134. package/lib/typescript/module/src/index.d.ts.map +1 -1
  135. package/lib/typescript/module/src/store.d.ts +6 -0
  136. package/lib/typescript/module/src/store.d.ts.map +1 -1
  137. package/lib/typescript/module/src/types/Conversation.d.ts +2 -0
  138. package/lib/typescript/module/src/types/Conversation.d.ts.map +1 -1
  139. package/lib/typescript/module/src/types/Theme.d.ts +9 -0
  140. package/lib/typescript/module/src/types/Theme.d.ts.map +1 -1
  141. package/lib/typescript/module/src/utils/deepMap.d.ts +7 -0
  142. package/lib/typescript/module/src/utils/deepMap.d.ts.map +1 -0
  143. package/lib/typescript/module/src/utils/formatDate.d.ts +2 -0
  144. package/lib/typescript/module/src/utils/formatDate.d.ts.map +1 -0
  145. package/lib/typescript/module/src/utils/scalingUtils.d.ts +10 -0
  146. package/lib/typescript/module/src/utils/scalingUtils.d.ts.map +1 -0
  147. package/lib/typescript/module/src/viewabilityConfig.d.ts +5 -0
  148. package/lib/typescript/module/src/viewabilityConfig.d.ts.map +1 -0
  149. package/package.json +1 -1
  150. package/src/App.tsx +4 -2
  151. package/src/assets/arrow-right.png +0 -0
  152. package/src/assets/headphones-01.png +0 -0
  153. package/src/assets/iconamoon_clock-fill.png +0 -0
  154. package/src/assets/info-circle.png +0 -0
  155. package/src/assets/message-notification-square.png +0 -0
  156. package/src/assets/x-close.png +0 -0
  157. package/src/components/ChatList.tsx +420 -60
  158. package/src/components/CustomAlert.tsx +132 -0
  159. package/src/components/CustomerForm.tsx +272 -224
  160. package/src/components/EmptyList.tsx +31 -7
  161. package/src/components/InitFailed.tsx +9 -6
  162. package/src/components/MessageInput.tsx +86 -49
  163. package/src/components/MessageItem.tsx +181 -58
  164. package/src/components/ScaledSheet.ts +93 -0
  165. package/src/components/SizeMatter.tsx +22 -0
  166. package/src/index.tsx +1 -0
  167. package/src/store.ts +13 -3
  168. package/src/types/Conversation.ts +2 -0
  169. package/src/types/Theme.ts +27 -0
  170. package/src/utils/deepMap.ts +47 -0
  171. package/src/utils/formatDate.ts +13 -0
  172. package/src/utils/scalingUtils.ts +27 -0
  173. package/src/viewabilityConfig.ts +4 -0
  174. package/lib/commonjs/assets/double-check.png +0 -0
  175. package/lib/commonjs/assets/send.png +0 -0
  176. package/lib/module/assets/double-check.png +0 -0
  177. package/lib/module/assets/send.png +0 -0
  178. package/src/assets/double-check.png +0 -0
  179. package/src/assets/send.png +0 -0
@@ -1,12 +1,11 @@
1
1
  import {
2
2
  View,
3
3
  TextInput,
4
- StyleSheet,
5
4
  TouchableOpacity,
6
- Modal,
7
- FlatList,
8
5
  Pressable,
9
6
  Keyboard,
7
+ Image,
8
+ ScrollView,
10
9
  } from 'react-native';
11
10
  import { useForm, Controller } from 'react-hook-form';
12
11
  import { useAppStore } from '../store';
@@ -14,8 +13,9 @@ import { createCustomer } from '../api';
14
13
  import { AppText } from './AppText';
15
14
  import { useLocalize } from '../hooks/useLocalize';
16
15
  import { useThemeColors } from '../hooks/useThemeColors';
16
+ import CustomPopup from './CustomAlert';
17
17
  import { useState } from 'react';
18
- import { countries } from '../constants/countries';
18
+ import { ScaledSheet } from './ScaledSheet';
19
19
 
20
20
  interface CustomerFormData {
21
21
  name: string;
@@ -24,7 +24,15 @@ interface CustomerFormData {
24
24
  phone: string;
25
25
  }
26
26
 
27
- export function CustomerForm() {
27
+ const closeIcon = require('../assets/x-close.png');
28
+ const infoIcon = require('../assets/info-circle.png');
29
+
30
+ interface InfoButtonProps {
31
+ title: string;
32
+ description: string;
33
+ }
34
+
35
+ export function CustomerForm({ onBack }: { onBack: () => void }) {
28
36
  const {
29
37
  control,
30
38
  handleSubmit,
@@ -32,14 +40,18 @@ export function CustomerForm() {
32
40
  } = useForm<CustomerFormData>();
33
41
  const themeColors = useThemeColors();
34
42
  const localize = useLocalize();
35
- const [isCountryModalVisible, setIsCountryModalVisible] = useState(false);
36
43
 
37
44
  const inputStyle = {
38
45
  ...styles.input,
39
46
  color: themeColors.text,
40
- borderColor: themeColors.border,
47
+ borderColor: themeColors.gainsboro,
41
48
  backgroundColor: themeColors.background,
42
49
  };
50
+ const [popupVisible, setPopupVisible] = useState(false);
51
+ const [popupContent, setPopupContent] = useState({
52
+ title: '',
53
+ description: 'null',
54
+ });
43
55
 
44
56
  const onSubmit = async (data: CustomerFormData) => {
45
57
  try {
@@ -61,265 +73,273 @@ export function CustomerForm() {
61
73
  }
62
74
  };
63
75
 
76
+ const showErrorPopup = (title: string, description: string) => {
77
+ setPopupVisible(true);
78
+ setPopupContent({
79
+ title: title ?? 'customer.form.failed.name',
80
+ description: description ?? 'customer.form.failed.name.desc',
81
+ });
82
+ };
83
+
84
+ // eslint-disable-next-line react/no-unstable-nested-components
85
+ const InfoButton = ({ title, description }: InfoButtonProps) => {
86
+ return (
87
+ <TouchableOpacity
88
+ onPress={() => showErrorPopup(title, description)}
89
+ activeOpacity={1}
90
+ >
91
+ <Image source={infoIcon} style={styles.infoIcon} />
92
+ </TouchableOpacity>
93
+ );
94
+ };
95
+
64
96
  return (
65
97
  <Pressable
66
98
  style={[styles.container, { backgroundColor: themeColors.background }]}
67
99
  onPress={Keyboard.dismiss}
68
100
  >
69
- <View style={styles.headerContainer}>
70
- <AppText
71
- localization="customer.form.title"
72
- style={[styles.headerText, { color: themeColors.text }]}
73
- />
74
- <AppText
75
- localization="customer.form.instructions"
76
- style={[styles.headerText, { color: themeColors.text }]}
77
- />
78
- </View>
79
- <Controller
80
- control={control}
81
- rules={{
82
- maxLength: {
83
- value: 30,
84
- message: localize('customer.form.validation.name.maxLength'),
85
- },
86
- }}
87
- render={({ field: { onChange, value } }) => (
88
- <TextInput
89
- style={inputStyle}
90
- placeholder={localize('customer.form.placeholder.name')}
91
- placeholderTextColor="#6C757D"
92
- value={value}
93
- onChangeText={onChange}
94
- />
95
- )}
96
- name="name"
97
- />
98
- {errors.name && (
99
- <AppText
100
- localization={errors.name.message ? undefined : 'customer.form.error'}
101
- style={[styles.error, { color: themeColors.error }]}
101
+ <ScrollView
102
+ contentContainerStyle={styles.scrollContainer}
103
+ keyboardShouldPersistTaps="handled"
104
+ >
105
+ <View
106
+ style={[
107
+ styles.container,
108
+ { backgroundColor: themeColors.background },
109
+ ]}
102
110
  >
103
- {errors.name.message}
104
- </AppText>
105
- )}
106
-
107
- <Controller
108
- control={control}
109
- rules={{
110
- maxLength: {
111
- value: 2,
112
- message: localize('customer.form.validation.country.maxLength'),
113
- },
114
- }}
115
- render={({ field: { onChange, value } }) => (
116
- <>
117
- <Pressable
111
+ <TouchableOpacity
112
+ style={[
113
+ styles.iconContainer,
114
+ { backgroundColor: themeColors.dark_background },
115
+ ]}
116
+ onPress={onBack}
117
+ >
118
+ <Image
119
+ source={closeIcon}
120
+ style={[styles.closeIcon, { tintColor: themeColors.light_text }]}
121
+ />
122
+ </TouchableOpacity>
123
+ <View
124
+ style={[
125
+ styles.headerContainer,
126
+ { backgroundColor: themeColors.dark_background },
127
+ ]}
128
+ >
129
+ <AppText
130
+ localization="customer.form.title"
131
+ style={[styles.headerText, { color: themeColors.gainsboro }]}
132
+ />
133
+ <AppText
134
+ localization="customer.form.instructions"
135
+ style={[styles.headerText, { color: themeColors.light_text }]}
136
+ />
137
+ </View>
138
+ <View style={styles.titleContainer}>
139
+ <AppText
118
140
  style={[
119
- styles.input,
141
+ styles.title,
120
142
  {
121
- borderColor: themeColors.border,
122
- backgroundColor: themeColors.background,
123
- justifyContent: 'center',
143
+ color: themeColors.slate,
124
144
  },
125
145
  ]}
126
- onPress={() => setIsCountryModalVisible(true)}
127
146
  >
128
- <AppText style={{ color: value ? themeColors.text : '#6C757D' }}>
129
- {value
130
- ? countries.find((c) => c.code === value)?.name
131
- : localize('customer.form.placeholder.country')}
132
- </AppText>
133
- </Pressable>
134
-
135
- <Modal
136
- visible={isCountryModalVisible}
137
- transparent={true}
138
- animationType="slide"
139
- onRequestClose={() => setIsCountryModalVisible(false)}
147
+ {localize('customer.form.title')}
148
+ </AppText>
149
+ <Controller
150
+ control={control}
151
+ rules={{
152
+ maxLength: {
153
+ value: 30,
154
+ message: localize('customer.form.validation.name.maxLength'),
155
+ },
156
+ }}
157
+ render={({ field: { onChange, value } }) => (
158
+ <View
159
+ style={[
160
+ styles.inputContainer,
161
+ { borderBottomColor: themeColors.gainsboro },
162
+ ]}
163
+ >
164
+ <TextInput
165
+ style={inputStyle}
166
+ placeholder={localize('customer.form.placeholder.name')}
167
+ placeholderTextColor={themeColors.gainsboro}
168
+ value={value}
169
+ onChangeText={onChange}
170
+ />
171
+ {errors.name && (
172
+ <InfoButton
173
+ title={'customer.form.failed.name'}
174
+ description={'customer.form.failed.name.desc'}
175
+ />
176
+ )}
177
+ </View>
178
+ )}
179
+ name="name"
180
+ />
181
+ <AppText
182
+ style={[
183
+ styles.title,
184
+ {
185
+ color: themeColors.slate,
186
+ },
187
+ ]}
140
188
  >
141
- <View
142
- style={[
143
- styles.modalContainer,
144
- { backgroundColor: 'rgba(0, 0, 0, 0.5)' },
145
- ]}
146
- >
189
+ Email
190
+ </AppText>
191
+ <Controller
192
+ control={control}
193
+ rules={{
194
+ pattern: {
195
+ value: /^\S+@\S+$/i,
196
+ message: localize('customer.form.validation.email.pattern'),
197
+ },
198
+ }}
199
+ render={({ field: { onChange, value } }) => (
147
200
  <View
148
201
  style={[
149
- styles.modalContent,
150
- { backgroundColor: themeColors.background },
202
+ styles.inputContainer,
203
+ { borderBottomColor: themeColors.gainsboro },
151
204
  ]}
152
205
  >
153
- <FlatList
154
- data={countries}
155
- keyExtractor={(item) => item.code}
156
- initialScrollIndex={countries.findIndex(
157
- (c) => c.code === value
158
- )}
159
- renderItem={({ item }) => (
160
- <Pressable
161
- style={[
162
- styles.countryItem,
163
- {
164
- backgroundColor:
165
- value === item.code
166
- ? themeColors.primary
167
- : themeColors.background,
168
- borderBottomColor: themeColors.border,
169
- },
170
- ]}
171
- onPress={() => {
172
- onChange(item.code);
173
- setIsCountryModalVisible(false);
174
- }}
175
- >
176
- <AppText
177
- style={{
178
- color:
179
- value === item.code
180
- ? themeColors.background
181
- : themeColors.text,
182
- fontSize: 16,
183
- }}
184
- >
185
- {item.name}
186
- </AppText>
187
- </Pressable>
188
- )}
206
+ <TextInput
207
+ style={inputStyle}
208
+ placeholder={localize('customer.form.placeholder.email')}
209
+ placeholderTextColor={themeColors.gainsboro}
210
+ value={value}
211
+ onChangeText={onChange}
212
+ keyboardType="email-address"
189
213
  />
214
+ {errors.email && (
215
+ <InfoButton
216
+ title={'customer.form.failed.email'}
217
+ description={'customer.form.failed.email.desc'}
218
+ />
219
+ )}
190
220
  </View>
191
- </View>
192
- </Modal>
193
- </>
194
- )}
195
- name="country"
196
- />
197
- {errors.country && (
198
- <AppText
199
- localization={
200
- errors.country.message ? undefined : 'customer.form.error'
201
- }
202
- style={[styles.error, { color: themeColors.error }]}
203
- >
204
- {errors.country.message}
205
- </AppText>
206
- )}
207
-
208
- <Controller
209
- control={control}
210
- rules={{
211
- pattern: {
212
- value: /^\S+@\S+$/i,
213
- message: localize('customer.form.validation.email.pattern'),
214
- },
221
+ )}
222
+ name="email"
223
+ />
224
+ <AppText
225
+ style={[
226
+ styles.title,
227
+ {
228
+ color: themeColors.slate,
229
+ },
230
+ ]}
231
+ >
232
+ Phone
233
+ </AppText>
234
+ <Controller
235
+ control={control}
236
+ rules={{
237
+ validate: (value) => {
238
+ if (!value) return true;
239
+ return (
240
+ typeof value === 'string' ||
241
+ localize('customer.form.validation.phone.invalid')
242
+ );
243
+ },
244
+ }}
245
+ render={({ field: { onChange, value } }) => (
246
+ <View
247
+ style={[
248
+ styles.inputContainer,
249
+ { borderBottomColor: themeColors.gainsboro },
250
+ ]}
251
+ >
252
+ <TextInput
253
+ style={inputStyle}
254
+ placeholder={localize('customer.form.placeholder.phone')}
255
+ placeholderTextColor={themeColors.gainsboro}
256
+ value={value}
257
+ onChangeText={onChange}
258
+ keyboardType="phone-pad"
259
+ />
260
+ {errors.phone && (
261
+ <InfoButton
262
+ title={'customer.form.failed.phone'}
263
+ description={'customer.form.failed.phone.desc'}
264
+ />
265
+ )}
266
+ </View>
267
+ )}
268
+ name="phone"
269
+ />
270
+ </View>
271
+ <TouchableOpacity
272
+ style={[
273
+ styles.button,
274
+ { backgroundColor: themeColors.dark_background },
275
+ ]}
276
+ onPress={handleSubmit(onSubmit)}
277
+ >
278
+ <AppText
279
+ localization="customer.form.submit"
280
+ style={[styles.buttonText, { color: themeColors.light_text }]}
281
+ />
282
+ </TouchableOpacity>
283
+ </View>
284
+ </ScrollView>
285
+ <CustomPopup
286
+ isVisible={popupVisible}
287
+ onClose={() => setPopupVisible(false)}
288
+ title={popupContent.title}
289
+ description={popupContent.description}
290
+ onCancelButton={() => {
291
+ setPopupVisible(false);
292
+ setPopupContent({ title: '', description: '' });
215
293
  }}
216
- render={({ field: { onChange, value } }) => (
217
- <TextInput
218
- style={inputStyle}
219
- placeholder={localize('customer.form.placeholder.email')}
220
- placeholderTextColor="#6C757D"
221
- value={value}
222
- onChangeText={onChange}
223
- keyboardType="email-address"
224
- />
225
- )}
226
- name="email"
227
- />
228
- {errors.email && (
229
- <AppText
230
- localization={
231
- errors.email.message ? undefined : 'customer.form.error'
232
- }
233
- style={[styles.error, { color: themeColors.error }]}
234
- >
235
- {errors.email.message}
236
- </AppText>
237
- )}
238
-
239
- <Controller
240
- control={control}
241
- rules={{
242
- validate: (value) => {
243
- if (!value) return true;
244
- return (
245
- typeof value === 'string' ||
246
- localize('customer.form.validation.phone.invalid')
247
- );
248
- },
294
+ onResendButton={() => {
295
+ setPopupVisible(false);
249
296
  }}
250
- render={({ field: { onChange, value } }) => (
251
- <TextInput
252
- style={inputStyle}
253
- placeholder={localize('customer.form.placeholder.phone')}
254
- placeholderTextColor="#6C757D"
255
- value={value}
256
- onChangeText={onChange}
257
- keyboardType="phone-pad"
258
- />
259
- )}
260
- name="phone"
261
297
  />
262
- {errors.phone && (
263
- <AppText
264
- localization={
265
- errors.phone.message ? undefined : 'customer.form.error'
266
- }
267
- style={[styles.error, { color: themeColors.error }]}
268
- >
269
- {errors.phone.message}
270
- </AppText>
271
- )}
272
- <TouchableOpacity
273
- style={[styles.button, { backgroundColor: themeColors.primary }]}
274
- onPress={handleSubmit(onSubmit)}
275
- >
276
- <AppText
277
- localization="customer.form.submit"
278
- style={styles.buttonText}
279
- />
280
- </TouchableOpacity>
281
298
  </Pressable>
282
299
  );
283
300
  }
284
301
 
285
- const styles = StyleSheet.create({
302
+ const styles = ScaledSheet.create({
286
303
  container: {
287
- padding: 24,
304
+ paddingBottom: '24@vs',
288
305
  flex: 1,
289
- justifyContent: 'center',
306
+ justifyContent: 'space-between',
290
307
  },
291
308
  headerContainer: {
292
- marginBottom: 24,
309
+ paddingHorizontal: '24@s',
310
+ marginBottom: '24@vs',
311
+ paddingBottom: '32@vs',
293
312
  },
294
313
  headerText: {
295
- fontSize: 15,
314
+ fontSize: '30@vs',
296
315
  fontWeight: '600',
297
- textAlign: 'center',
316
+ textAlign: 'left',
298
317
  },
299
318
  input: {
300
- height: 56,
301
- borderWidth: 1,
302
- borderRadius: 12,
303
- paddingHorizontal: 16,
304
- fontSize: 16,
319
+ borderRadius: '12@s',
320
+ paddingHorizontal: '12@s',
321
+ fontSize: '16@vs',
305
322
  backgroundColor: 'white',
306
- marginBottom: 16,
323
+ paddingVertical: '8@vs',
324
+ width: '95%',
307
325
  },
308
326
  button: {
309
- padding: 16,
310
- borderRadius: 12,
327
+ paddingHorizontal: '16@s',
328
+ paddingVertical: '16@vs',
329
+ borderRadius: '12@s',
311
330
  alignItems: 'center',
312
- marginTop: 24,
331
+ marginTop: '24@vs',
332
+ marginHorizontal: '20@s',
313
333
  },
314
334
  buttonText: {
315
335
  color: 'white',
316
- fontSize: 16,
336
+ fontSize: '16@vs',
317
337
  fontWeight: '600',
318
338
  },
319
339
  error: {
320
- fontSize: 14,
321
- marginLeft: 16,
322
- top: -16,
340
+ fontSize: '14@vs',
341
+ marginLeft: '16@s',
342
+ top: '-16@vs',
323
343
  },
324
344
  modalContainer: {
325
345
  flex: 1,
@@ -329,11 +349,39 @@ const styles = StyleSheet.create({
329
349
  modalContent: {
330
350
  width: '90%',
331
351
  height: '70%',
332
- borderRadius: 12,
352
+ borderRadius: '12@s',
333
353
  overflow: 'hidden',
334
354
  },
335
355
  countryItem: {
336
- padding: 16,
356
+ paddingHorizontal: '16@s',
357
+ paddingVertical: '16@vs',
358
+ borderBottomWidth: 1,
359
+ },
360
+ title: {
361
+ fontSize: '16@vs',
362
+ },
363
+ iconContainer: {
364
+ paddingHorizontal: '20@s',
365
+ paddingVertical: '10@vs',
366
+ },
367
+ inputContainer: {
368
+ flexDirection: 'row',
369
+ alignItems: 'center',
337
370
  borderBottomWidth: 1,
371
+ marginBottom: '8@vs',
372
+ },
373
+ closeIcon: {
374
+ width: '24@vs',
375
+ height: '24@vs',
376
+ },
377
+ scrollContainer: {
378
+ flexGrow: 1,
379
+ justifyContent: 'space-between',
380
+ },
381
+ infoIcon: {
382
+ width: '24@vs',
383
+ height: '24@vs',
384
+ tintColor: 'red',
338
385
  },
386
+ titleContainer: { marginHorizontal: '20@s', flex: 1 },
339
387
  });
@@ -1,6 +1,10 @@
1
- import { View, StyleSheet } from 'react-native';
1
+ import { View, Image } from 'react-native';
2
2
  import { useThemeColors } from '../hooks/useThemeColors';
3
3
  import { AppText } from './AppText';
4
+ import type { LocalizationKeys } from '../types/LocalizationKeys';
5
+ import { ScaledSheet } from './ScaledSheet';
6
+
7
+ const notificationIcon = require('../assets/message-notification-square.png');
4
8
 
5
9
  export function EmptyList() {
6
10
  const themeColors = useThemeColors();
@@ -9,24 +13,44 @@ export function EmptyList() {
9
13
  <View
10
14
  style={[styles.container, { backgroundColor: themeColors.background }]}
11
15
  >
16
+ <Image
17
+ source={notificationIcon}
18
+ style={[styles.notificationIcon, { tintColor: themeColors.text }]}
19
+ />
20
+ <AppText
21
+ localization={'chat.empty.title' as keyof LocalizationKeys}
22
+ style={[styles.title, { color: themeColors.text }]}
23
+ />
12
24
  <AppText
13
- localization="chat.empty"
14
- style={[styles.text, { color: themeColors.text }]}
25
+ localization={'chat.empty.description' as keyof LocalizationKeys}
26
+ style={[styles.description, { color: themeColors.text }]}
15
27
  />
16
28
  </View>
17
29
  );
18
30
  }
19
31
 
20
- const styles = StyleSheet.create({
32
+ const styles = ScaledSheet.create({
21
33
  container: {
22
34
  flex: 1,
23
35
  alignItems: 'center',
24
36
  justifyContent: 'center',
25
- padding: 20,
37
+ paddingHorizontal: '20@s',
38
+ paddingVertical: '20@vs',
26
39
  transform: [{ rotate: '180deg' }], //TODO: inverted list
40
+ gap: 15,
27
41
  },
28
- text: {
29
- fontSize: 16,
42
+ title: {
43
+ fontSize: '18@vs',
30
44
  textAlign: 'center',
45
+ fontWeight: 600,
46
+ },
47
+ description: {
48
+ fontSize: '16@vs',
49
+ textAlign: 'center',
50
+ fontWeight: 400,
51
+ },
52
+ notificationIcon: {
53
+ width: '40@vs',
54
+ height: '40@vs',
31
55
  },
32
56
  });
@@ -1,6 +1,7 @@
1
- import { TouchableOpacity, View, StyleSheet } from 'react-native';
1
+ import { TouchableOpacity, View } from 'react-native';
2
2
  import { useThemeColors } from '../hooks/useThemeColors';
3
3
  import { AppText } from './AppText';
4
+ import { ScaledSheet } from './ScaledSheet';
4
5
 
5
6
  interface InitFailedProps {
6
7
  setInitFailed: (value: boolean) => void;
@@ -26,21 +27,23 @@ export function InitFailed({ setInitFailed }: InitFailedProps) {
26
27
  );
27
28
  }
28
29
 
29
- const styles = StyleSheet.create({
30
+ const styles = ScaledSheet.create({
30
31
  container: {
31
32
  flex: 1,
32
33
  alignItems: 'center',
33
34
  justifyContent: 'center',
34
- padding: 20,
35
+ paddingHorizontal: '20@s',
36
+ paddingVertical: '20@vs',
35
37
  },
36
38
  retryButton: {
37
- padding: 15,
38
- borderRadius: 8,
39
+ paddingHorizontal: '15@s',
40
+ paddingVertical: '15@vs',
41
+ borderRadius: '8@s',
39
42
  alignItems: 'center',
40
43
  justifyContent: 'center',
41
44
  },
42
45
  retryText: {
43
- fontSize: 16,
46
+ fontSize: '16@vs',
44
47
  fontWeight: '500',
45
48
  },
46
49
  });