ipanel-rnapp-ajb-base 1.0.0

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 (155) hide show
  1. package/app/.local_dev/DemoPage.js +46 -0
  2. package/app/.local_dev/env.js +1 -0
  3. package/app/.local_dev/polyfill.js +83 -0
  4. package/app/App.js +485 -0
  5. package/app/api/homedApi.js +42 -0
  6. package/app/api/index.js +2 -0
  7. package/app/api/ipanelCloudApi.js +796 -0
  8. package/app/assets/img/add.png +0 -0
  9. package/app/assets/img/add_img.png +0 -0
  10. package/app/assets/img/album.png +0 -0
  11. package/app/assets/img/album2.png +0 -0
  12. package/app/assets/img/album3.png +0 -0
  13. package/app/assets/img/album@2x.png +0 -0
  14. package/app/assets/img/album@3x.png +0 -0
  15. package/app/assets/img/audioRecordBar.png +0 -0
  16. package/app/assets/img/bootom_bar_bg.png +0 -0
  17. package/app/assets/img/close.png +0 -0
  18. package/app/assets/img/computer.png +0 -0
  19. package/app/assets/img/confirm.png +0 -0
  20. package/app/assets/img/delete_pic.png +0 -0
  21. package/app/assets/img/disabled.png +0 -0
  22. package/app/assets/img/goBack.png +0 -0
  23. package/app/assets/img/goBack2.png +0 -0
  24. package/app/assets/img/ischeck.png +0 -0
  25. package/app/assets/img/launch_bg.png +0 -0
  26. package/app/assets/img/launch_bg_panyu.png +0 -0
  27. package/app/assets/img/launch_logo.png +0 -0
  28. package/app/assets/img/launch_logo_panyu.png +0 -0
  29. package/app/assets/img/launch_text.png +0 -0
  30. package/app/assets/img/launch_text_panyu.png +0 -0
  31. package/app/assets/img/link.png +0 -0
  32. package/app/assets/img/login_bg.png +0 -0
  33. package/app/assets/img/login_bg_new.png +0 -0
  34. package/app/assets/img/login_left.png +0 -0
  35. package/app/assets/img/login_right.png +0 -0
  36. package/app/assets/img/nocheck.png +0 -0
  37. package/app/assets/img/personal.png +0 -0
  38. package/app/assets/img/photo.png +0 -0
  39. package/app/assets/img/photo@2x.png +0 -0
  40. package/app/assets/img/photo@3x.png +0 -0
  41. package/app/assets/img/protocol_checked.png +0 -0
  42. package/app/assets/img/qiehuan.png +0 -0
  43. package/app/assets/img/scan_border_bottom_left.png +0 -0
  44. package/app/assets/img/scan_border_bottom_right.png +0 -0
  45. package/app/assets/img/scan_border_top_left.png +0 -0
  46. package/app/assets/img/scan_border_top_right.png +0 -0
  47. package/app/assets/img/scan_move.png +0 -0
  48. package/app/assets/img/szjt.png +0 -0
  49. package/app/assets/img/tab.png +0 -0
  50. package/app/assets/img/tykz.png +0 -0
  51. package/app/assets/img/update_bg.png +0 -0
  52. package/app/assets/img/video.png +0 -0
  53. package/app/assets/img/video@2x.png +0 -0
  54. package/app/assets/img/video@3x.png +0 -0
  55. package/app/assets/img/worker.png +0 -0
  56. package/app/assets/img/wx.png +0 -0
  57. package/app/assets/img/ykq.png +0 -0
  58. package/app/assets/img/zfb.png +0 -0
  59. package/app/base.js +342 -0
  60. package/app/components/VersionUpdateConfirm.js +117 -0
  61. package/app/components/common/AccordionCell/index.js +67 -0
  62. package/app/components/common/ActionPicker/BasicPicker.js +136 -0
  63. package/app/components/common/ActionPicker/index.js +106 -0
  64. package/app/components/common/AddressPicker/index.js +211 -0
  65. package/app/components/common/Card/index.js +19 -0
  66. package/app/components/common/Cell/index.js +381 -0
  67. package/app/components/common/CustomDialog/index.js +120 -0
  68. package/app/components/common/CustomTabBar/index.js +157 -0
  69. package/app/components/common/CustomTabBar_bak/TabBarInput.js +210 -0
  70. package/app/components/common/CustomTabBar_bak/index.js +832 -0
  71. package/app/components/common/DateTimingPicker/index.js +254 -0
  72. package/app/components/common/Dialog/Notify.js +36 -0
  73. package/app/components/common/Dialog/baseDialog.js +146 -0
  74. package/app/components/common/Dialog/index.js +113 -0
  75. package/app/components/common/Dialog/prompt.js +145 -0
  76. package/app/components/common/Dialog/quickSelect.js +54 -0
  77. package/app/components/common/Dialog/select.js +125 -0
  78. package/app/components/common/Dialog/styles.js +167 -0
  79. package/app/components/common/Loading/index.js +71 -0
  80. package/app/components/common/LoginType/index.js +171 -0
  81. package/app/components/common/LoginType/protocol.js +160 -0
  82. package/app/components/common/Notify/index.js +68 -0
  83. package/app/components/common/OnceTouchable/index.js +33 -0
  84. package/app/components/common/PaymentPicker/index.js +264 -0
  85. package/app/components/common/ProductOrderPicker/index.js +524 -0
  86. package/app/components/common/ScreenBackHeader/index.js +144 -0
  87. package/app/components/common/ScrollPicker/index.js +232 -0
  88. package/app/components/common/SelectPicker/index.js +171 -0
  89. package/app/components/common/SmsCodeInput/index.js +93 -0
  90. package/app/components/common/SmsCodeInput/indexNew.js +101 -0
  91. package/app/components/common/Steps/index.js +126 -0
  92. package/app/components/common/Tag/index.js +17 -0
  93. package/app/components/common/Toast/index.js +103 -0
  94. package/app/components/common/WeekDaysPicker/index.js +196 -0
  95. package/app/components/index.js +8 -0
  96. package/app/components/iot/AddDeviceActionSheet/index.js +934 -0
  97. package/app/components/iot/AddressActionSheet/index.js +91 -0
  98. package/app/components/iot/RoomActionSheet/index.js +205 -0
  99. package/app/components/iot/ViewDeviceActionSheet/index.js +834 -0
  100. package/app/components/sheets.js +30 -0
  101. package/app/eventBus/index.js +54 -0
  102. package/app/hooks/checkLogin.js +30 -0
  103. package/app/hooks/shopMessageManager.js +308 -0
  104. package/app/hooks/useAddress.js +179 -0
  105. package/app/hooks/useAddress2.js +587 -0
  106. package/app/hooks/useDebounceFn.js +6 -0
  107. package/app/hooks/useDynamicPackages.js +22 -0
  108. package/app/hooks/useKeyboard.js +25 -0
  109. package/app/hooks/useLatest.js +10 -0
  110. package/app/hooks/useMessageManager.js +368 -0
  111. package/app/hooks/useNavigationFocus.js +19 -0
  112. package/app/hooks/useUser.js +56 -0
  113. package/app/screens/BaseScreen.js +389 -0
  114. package/app/screens/CommonScreens/BindPhoneScreen/index.js +179 -0
  115. package/app/screens/CommonScreens/BossScreen/index.js +138 -0
  116. package/app/screens/CommonScreens/DeviceAnswerDetailScreen/index.js +50 -0
  117. package/app/screens/CommonScreens/DeviceFeedbackScreen/index.js +365 -0
  118. package/app/screens/CommonScreens/EditInvoiceTitleScreen/index.js +279 -0
  119. package/app/screens/CommonScreens/FamilyDetailScreen/index.js +421 -0
  120. package/app/screens/CommonScreens/InvoiceTitleListScreen/index.js +118 -0
  121. package/app/screens/CommonScreens/OperatorSelectScreen/index.js +315 -0
  122. package/app/screens/CommonScreens/PersonalScreen/index.js +348 -0
  123. package/app/screens/CommonScreens/ScanQRCodeScreen/index.js +407 -0
  124. package/app/screens/CommonScreens/TvAlbumScreen/index.js +407 -0
  125. package/app/screens/LoginScreen/OpenLogSheet.js +241 -0
  126. package/app/screens/LoginScreen/index.js +920 -0
  127. package/app/screens/LoginScreen/indexNew.js +1354 -0
  128. package/app/screens/ResePassword/index.js +364 -0
  129. package/app/screens/SbkScreen.js +19 -0
  130. package/app/screens/WebviewScreen.js +41 -0
  131. package/app/storage/index.js +166 -0
  132. package/app/utils/EventEmitter.js +43 -0
  133. package/app/utils/RootNavigation.js +32 -0
  134. package/app/utils/SBK_plugin/convert.js +90 -0
  135. package/app/utils/SBK_plugin/convertStatus.js +250 -0
  136. package/app/utils/SBK_plugin/eventProcess.js +339 -0
  137. package/app/utils/SBK_plugin/index.js +32 -0
  138. package/app/utils/SBK_plugin/ipanelDeviceToSbkDevice.js +68 -0
  139. package/app/utils/SBK_plugin/sbk_defs.js +191 -0
  140. package/app/utils/StyleComposite.js +37 -0
  141. package/app/utils/applyPermissions.js +251 -0
  142. package/app/utils/bundleUpdater.js +46 -0
  143. package/app/utils/common.js +380 -0
  144. package/app/utils/config.js +47 -0
  145. package/app/utils/errCodes.js +3 -0
  146. package/app/utils/homedData.js +57 -0
  147. package/app/utils/http.js +178 -0
  148. package/app/utils/notice.js +15 -0
  149. package/app/utils/priceConversion.js +30 -0
  150. package/app/utils/registerDialog.js +90 -0
  151. package/app/utils/scaleSize.js +12 -0
  152. package/app/utils/soundPlayer.js +85 -0
  153. package/bin/local-dev.js +7 -0
  154. package/index.js +8 -0
  155. package/package.json +18 -0
@@ -0,0 +1,524 @@
1
+ import React, { useMemo, useState } from "react";
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ Image,
8
+ ScrollView,
9
+ TextInput,
10
+ Platform,
11
+ } from "react-native";
12
+ import ActionSheet, { SheetManager } from "react-native-actions-sheet";
13
+ import { Icon } from "@rneui/themed";
14
+ import px from "../../../utils/scaleSize";
15
+ import { regFenToYuan } from "../../../utils/priceConversion";
16
+
17
+ // const deviceHeight = Dimensions.get('window').height;
18
+ const { navigate } = global.base;
19
+
20
+ const Index = ({ sheetId, payload }) => {
21
+ // 价格 购买类型 规格
22
+ const {
23
+ buyTypes = [],
24
+ defaultBuyTypeIndex = 0, // 购买类型
25
+ // specificationList = [],
26
+ defaultSpecificationIndex = 0,
27
+ services = [],
28
+ defaultSelectServiceIndexs = [],
29
+ count = 1,
30
+ productOption = {}, // 商品所有信息
31
+ // selectOption = {}, // 选择的子商品
32
+ posterUrl = "",
33
+ addressInfo = {},
34
+ setOption = () => {},
35
+ setIndex = () => {},
36
+ addShopCart = () => {},
37
+ type = "", // 购物车切换规格或者购买选择规格
38
+ handelSureSpecifications = () => {},
39
+ } = payload;
40
+
41
+ const [selectProduct, setSelectProduct] = useState(
42
+ productOption?.option[defaultSpecificationIndex]
43
+ );
44
+
45
+ // 第一行规格
46
+ const specificationListRow1 = productOption.option.slice(
47
+ 0,
48
+ Math.ceil(productOption.option.length / 2)
49
+ );
50
+ // 第二行规格
51
+ const specificationListRow2 = productOption.option.slice(
52
+ Math.ceil(productOption.option.length / 2)
53
+ );
54
+
55
+ const [selectServiceIndexs, setSelectServiceIndexs] = useState(
56
+ defaultSelectServiceIndexs
57
+ );
58
+ const [activeSpecificationIndex, setActiveSpecificationIndex] = useState(
59
+ defaultSpecificationIndex
60
+ );
61
+ const [activeBuyTypeIndex, setActiveBuyTypeIndex] =
62
+ useState(defaultBuyTypeIndex);
63
+ const [selectCount, setSelectCount] = useState(String(count));
64
+
65
+ const [buyTypesList, setBuyTypesList] = useState(buyTypes);
66
+
67
+ const TabBox = ({ title, active = false, style, ...props }) => {
68
+ return (
69
+ <TouchableOpacity
70
+ {...props}
71
+ style={[styles.tagBox, style, active ? styles.tagBoxActive : {}]}
72
+ >
73
+ <Text style={[styles.tabText, active ? styles.tagTextActive : {}]}>
74
+ {title}
75
+ </Text>
76
+ </TouchableOpacity>
77
+ );
78
+ };
79
+
80
+ const handlerServicePress = (index) => {
81
+ if (selectServiceIndexs.includes(index)) {
82
+ selectServiceIndexs.splice(selectServiceIndexs.indexOf(index), 1);
83
+ setSelectServiceIndexs([...selectServiceIndexs]);
84
+ } else {
85
+ setSelectServiceIndexs([...selectServiceIndexs, index]);
86
+ }
87
+ };
88
+
89
+ const productDesc = useMemo(() => {
90
+ return `${productOption.option[activeSpecificationIndex].title}x${selectCount}`;
91
+ }, [activeSpecificationIndex, selectCount]);
92
+
93
+ const handlerMinus = () => {
94
+ if (Number(selectCount) > 1) {
95
+ setSelectCount(String(Number(selectCount) - 1));
96
+ }
97
+ };
98
+
99
+ const handlerPlus = () => {
100
+ setSelectCount(String(Number(selectCount) + 1));
101
+ };
102
+
103
+ const changeCount = (val) => {
104
+ let num = Number(val);
105
+ if (num <= 0 || !num) {
106
+ num = 1;
107
+ }
108
+ setSelectCount(String(num));
109
+ };
110
+ // 立即购买
111
+ const handleConfirm = () => {
112
+ navigate("ConfirmOrderScreen", {
113
+ list: [
114
+ {
115
+ count: Number(selectCount),
116
+ selectOption: selectProduct,
117
+ url: selectProduct.original_image_url || posterUrl,
118
+ productInfo: productOption,
119
+ buyTypes: activeBuyTypeIndex, // 购买类型
120
+ },
121
+ ],
122
+ addressInfo: addressInfo,
123
+ });
124
+ SheetManager.hide(sheetId);
125
+ };
126
+
127
+ // 加入购物车
128
+ const handleAddShopCart = () => {
129
+ addShopCart(selectProduct, Number(selectCount), sheetId);
130
+ };
131
+
132
+ const handleCannel = () => {
133
+ SheetManager.hide(sheetId);
134
+ };
135
+ const changeIndex = (index) => {
136
+ setActiveSpecificationIndex(index);
137
+ setOption(productOption?.option[index]);
138
+ setSelectProduct(productOption?.option[index]);
139
+ setIndex(index);
140
+ const types = [
141
+ {
142
+ type: 3,
143
+ name: "全款购买",
144
+ },
145
+ ];
146
+ if (productOption?.option[index]?.extend?.product?.price?.deposit) {
147
+ types.push({
148
+ type: 1,
149
+ name: "预定购买",
150
+ });
151
+ }
152
+ setBuyTypesList([...types]);
153
+ };
154
+ // 购物车选择商品回调
155
+ const selectSpecification = () => {
156
+ // activeSpecificationIndex选中第几个商品
157
+ handelSureSpecifications(activeSpecificationIndex);
158
+ SheetManager.hide(sheetId);
159
+ };
160
+ return (
161
+ <>
162
+ <ActionSheet
163
+ id={sheetId}
164
+ isModal={false}
165
+ overdrawSize={100}
166
+ overdrawEnabled={false}
167
+ >
168
+ <View style={styles.content}>
169
+ <Text style={styles.price}>
170
+ ¥{regFenToYuan(selectProduct?.current_price)}
171
+ </Text>
172
+ <Text style={styles.productDesc}>已选:{productDesc}</Text>
173
+ <View style={{ height: px(1600) }}>
174
+ <ScrollView
175
+ removeClippedSubviews={true}
176
+ showsVerticalScrollIndicator={false}
177
+ >
178
+ {buyTypesList.length > 0 && (
179
+ <View style={styles.buyType}>
180
+ <Text style={styles.title}>购买类型</Text>
181
+ <View style={styles.buyTypeList}>
182
+ {buyTypesList.map((item) => (
183
+ <TabBox
184
+ key={item.type}
185
+ title={item.name}
186
+ style={{
187
+ marginRight: px(55),
188
+ }}
189
+ active={activeBuyTypeIndex === item.type}
190
+ onPress={() => setActiveBuyTypeIndex(item.type)}
191
+ />
192
+ ))}
193
+ </View>
194
+ </View>
195
+ )}
196
+
197
+ <View style={styles.selectSpecification}>
198
+ <Text style={styles.title}>选择规格</Text>
199
+ <View style={styles.specificationListRow}>
200
+ {productOption.option.map((item, index) => (
201
+ <TabBox
202
+ key={index}
203
+ title={item.title}
204
+ active={activeSpecificationIndex === index}
205
+ style={{
206
+ marginRight: px(38),
207
+ marginBottom: px(38),
208
+ }}
209
+ onPress={() => changeIndex(index)}
210
+ />
211
+ ))}
212
+ {productOption.option.map((item, index) => (
213
+ <TabBox
214
+ key={index}
215
+ title={item.title}
216
+ active={activeSpecificationIndex === index}
217
+ style={{
218
+ marginRight: px(38),
219
+ marginBottom: px(38),
220
+ }}
221
+ onPress={() => changeIndex(index)}
222
+ />
223
+ ))}
224
+ </View>
225
+ </View>
226
+ {type !== "selectSpecifications" && (
227
+ <View style={styles.selectCount}>
228
+ <Text style={styles.title}>数量</Text>
229
+ <View style={styles.countBox}>
230
+ <TouchableOpacity
231
+ style={styles.minusBox}
232
+ onPress={handlerMinus}
233
+ >
234
+ {/*<ion-icon name="remove-outline"></ion-icon>*/}
235
+ <Icon
236
+ type="ionicon"
237
+ name="remove-outline"
238
+ size={px(70)}
239
+ color="#999"
240
+ />
241
+ </TouchableOpacity>
242
+ {/* <Text style={styles.countText}>{selectCount}</Text> */}
243
+ <TextInput
244
+ style={styles.countText}
245
+ keyboardType="numeric"
246
+ onChangeText={(text) => changeCount(text)}
247
+ value={selectCount}
248
+ />
249
+ <TouchableOpacity
250
+ style={styles.plusBox}
251
+ onPress={handlerPlus}
252
+ >
253
+ <Icon
254
+ type="ionicon"
255
+ name="add-outline"
256
+ size={px(70)}
257
+ color="#333"
258
+ />
259
+ </TouchableOpacity>
260
+ </View>
261
+ </View>
262
+ )}
263
+ {selectProduct.service && (
264
+ <View style={styles.service}>
265
+ <Text style={styles.title}>服务</Text>
266
+ <View style={styles.serviceList}>
267
+ {services.map((item, index) => (
268
+ <TabBox
269
+ key={index}
270
+ title={`${item.name} ¥${item.price}`}
271
+ active={selectServiceIndexs.includes(index)}
272
+ onPress={() => handlerServicePress(index)}
273
+ />
274
+ ))}
275
+ </View>
276
+ </View>
277
+ )}
278
+ </ScrollView>
279
+ </View>
280
+ {type === "selectSpecifications" ? (
281
+ <View
282
+ style={
283
+ Platform.OS === "ios" ? styles.iosBottomBtns : styles.bottomBtns
284
+ }
285
+ >
286
+ <TouchableOpacity
287
+ style={[styles.buy, { flex: 1 }]}
288
+ onPress={selectSpecification}
289
+ >
290
+ <Text style={styles.buyText}>确定</Text>
291
+ </TouchableOpacity>
292
+ </View>
293
+ ) : (
294
+ <View
295
+ style={
296
+ Platform.OS === "ios" ? styles.iosBottomBtns : styles.bottomBtns
297
+ }
298
+ >
299
+ <TouchableOpacity
300
+ style={styles.addShopCart}
301
+ onPress={handleAddShopCart}
302
+ >
303
+ <Text style={styles.addShopCartText}>加入购物车</Text>
304
+ </TouchableOpacity>
305
+ <TouchableOpacity style={styles.buy} onPress={handleConfirm}>
306
+ <Text style={styles.buyText}>立即购买</Text>
307
+ </TouchableOpacity>
308
+ </View>
309
+ )}
310
+ <View style={styles.productShow}>
311
+ <Image
312
+ source={{
313
+ uri: selectProduct.original_image_url || posterUrl,
314
+ }}
315
+ style={styles.productPoster}
316
+ />
317
+ </View>
318
+ <TouchableOpacity style={styles.closeBox} onPress={handleCannel}>
319
+ <Image
320
+ source={require("../../../assets/img/close.png")}
321
+ style={styles.closeImg}
322
+ />
323
+ </TouchableOpacity>
324
+ </View>
325
+ </ActionSheet>
326
+ </>
327
+ );
328
+ };
329
+
330
+ const styles = StyleSheet.create({
331
+ content: {
332
+ paddingHorizontal: px(55),
333
+ paddingTop: px(38),
334
+ position: "relative",
335
+ backgroundColor: "#fff",
336
+ },
337
+ title: {
338
+ fontSize: px(44),
339
+ lineHeight: px(77),
340
+ color: "#333",
341
+ },
342
+
343
+ tagBox: {
344
+ borderRadius: px(47),
345
+ paddingHorizontal: px(49),
346
+ backgroundColor: "#f9f9f9",
347
+ height: px(93),
348
+ justifyContent: "center",
349
+ alignItems: "center",
350
+ },
351
+ tabText: {
352
+ fontSize: px(38),
353
+ fontWeight: "400",
354
+ color: "#333",
355
+ // lineHeight: px(77),
356
+ },
357
+ tagTextActive: {
358
+ color: "#ea6000",
359
+ },
360
+ tagBoxActive: {
361
+ borderWidth: px(3),
362
+ borderStyle: "solid",
363
+ borderColor: "#ea6000",
364
+ backgroundColor: "rgba(234,96,0,0.1)",
365
+ paddingHorizontal: px(49 - 3),
366
+ },
367
+
368
+ price: {
369
+ fontSize: px(66),
370
+ fontWeight: "bold",
371
+ color: "#ea6000",
372
+ marginBottom: px(16),
373
+ marginLeft: px(385),
374
+ },
375
+ productDesc: {
376
+ fontSize: px(38),
377
+ color: "#666",
378
+ fontWeight: "400",
379
+ marginBottom: px(100),
380
+ marginLeft: px(385),
381
+ height: px(104),
382
+ },
383
+
384
+ // 购买类型
385
+ buyType: {
386
+ marginBottom: px(99),
387
+ },
388
+ buyTypeList: {
389
+ flexDirection: "row",
390
+ marginTop: px(27),
391
+ },
392
+
393
+ // 选择规格
394
+ selectSpecification: {},
395
+ specificationListRow: {
396
+ display: "flex",
397
+ flexDirection: "row",
398
+ flexWrap: "wrap",
399
+ marginTop: px(27),
400
+ },
401
+
402
+ // 数量
403
+ selectCount: {
404
+ flexDirection: "row",
405
+ justifyContent: "space-between",
406
+ marginBottom: px(99),
407
+ marginTop: px(50),
408
+ },
409
+ countBox: {
410
+ flexDirection: "row",
411
+ alignItems: "center",
412
+ },
413
+ minusBox: {
414
+ width: px(77),
415
+ height: px(77),
416
+ backgroundColor: "#fff",
417
+ borderWidth: px(3),
418
+ borderColor: "#eee",
419
+ justifyContent: "center",
420
+ alignItems: "center",
421
+ borderRadius: px(77 / 2),
422
+ },
423
+ plusBox: {
424
+ width: px(77),
425
+ height: px(77),
426
+ backgroundColor: "#fff",
427
+ borderWidth: px(3),
428
+ borderColor: "#eee",
429
+ justifyContent: "center",
430
+ alignItems: "center",
431
+ borderRadius: px(77 / 2),
432
+ },
433
+ countText: {
434
+ // marginHorizontal: px(38),
435
+ fontSize: px(44),
436
+ color: "#333",
437
+ // borderWidth: px(3),
438
+ // borderColor: '#eee',
439
+ height: px(77),
440
+ padding: 0,
441
+ width: px(120),
442
+ paddingHorizontal: px(10),
443
+ textAlign: "center",
444
+ },
445
+
446
+ service: {
447
+ marginBottom: px(82),
448
+ },
449
+ serviceList: {
450
+ flexDirection: "row",
451
+ marginTop: px(27),
452
+ },
453
+ bottomBtns: {
454
+ paddingTop: px(20),
455
+ flexDirection: "row",
456
+ justifyContent: "space-between",
457
+ },
458
+ iosBottomBtns: {
459
+ paddingTop: px(20),
460
+ marginBottom: px(50),
461
+ flexDirection: "row",
462
+ justifyContent: "space-between",
463
+ },
464
+ addShopCart: {
465
+ borderRadius: px(69),
466
+ borderWidth: px(3),
467
+ borderStyle: "solid",
468
+ borderColor: "#999",
469
+ width: px(467),
470
+ height: px(115),
471
+ justifyContent: "center",
472
+ alignItems: "center",
473
+ },
474
+ addShopCartText: {
475
+ color: "#333",
476
+ fontSize: px(44),
477
+ fontWeight: "500",
478
+ },
479
+ buy: {
480
+ width: px(467),
481
+ height: px(115),
482
+ backgroundColor: "#ea6000",
483
+ justifyContent: "center",
484
+ alignItems: "center",
485
+ borderRadius: px(69),
486
+ },
487
+ buyText: {
488
+ fontSize: px(44),
489
+ color: "#fff",
490
+ fontWeight: "500",
491
+ },
492
+
493
+ closeBox: {
494
+ position: "absolute",
495
+ top: px(36),
496
+ right: px(44),
497
+ },
498
+ closeImg: {
499
+ width: px(70),
500
+ height: px(70),
501
+ },
502
+
503
+ productShow: {
504
+ position: "absolute",
505
+ width: px(280),
506
+ height: px(280),
507
+ backgroundColor: "#f9f9f9",
508
+ borderRadius: px(22),
509
+ top: px(20),
510
+ left: px(55),
511
+ zIndex: 2000,
512
+ },
513
+ productPoster: {
514
+ width: px(280),
515
+ height: px(280),
516
+ },
517
+ tranparentStyle: {
518
+ height: px(82),
519
+ backgroundColor: "#fff",
520
+ opacity: 0,
521
+ },
522
+ });
523
+
524
+ export default Index;
@@ -0,0 +1,144 @@
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ StatusBar,
7
+ Platform,
8
+ Image,
9
+ TouchableOpacity,
10
+ TouchableHighlight,
11
+ } from 'react-native';
12
+ import {Icon} from '@rneui/themed';
13
+ import {useSafeArea} from 'react-native-safe-area-context';
14
+ import {goBack} from '../../../utils/RootNavigation';
15
+ import px from '../../../utils/scaleSize';
16
+
17
+ // screen自定义头部,带返回按钮,需要配合screen的headerShown: false配置使用
18
+ const Index = ({
19
+ navigation,
20
+ title,
21
+ headerRight = () => null,
22
+ backgroundColor = '#fff',
23
+ backColor = '#000',
24
+ backTheme = 'black', // black | white
25
+ titleStyle,
26
+ onBackPress,
27
+ showBack = true,
28
+ }) => {
29
+ const handleBack = () => {
30
+ if (typeof onBackPress === 'function') {
31
+ onBackPress();
32
+ } else {
33
+ goBack();
34
+ }
35
+ };
36
+
37
+ const insets = useSafeArea();
38
+
39
+ const statusBarPlaceholderStyle = {
40
+ height: (Platform.OS === 'ios' ? insets.top : 0) + StatusBar.currentHeight,
41
+ backgroundColor: backgroundColor,
42
+ };
43
+
44
+ const headerBackgroundColor = {
45
+ backgroundColor: backgroundColor,
46
+ };
47
+
48
+ return (
49
+ <>
50
+ <View style={statusBarPlaceholderStyle} />
51
+
52
+ <View style={[styles.header, headerBackgroundColor]}>
53
+ {/*<View style={styles.headerLeft}>*/}
54
+ {/* <Icon*/}
55
+ {/* style={styles.backBtn}*/}
56
+ {/* name="chevron-back"*/}
57
+ {/* type="ionicon"*/}
58
+ {/* size={30}*/}
59
+ {/* color={backColor}*/}
60
+ {/* onPress={handleBack}*/}
61
+ {/* />*/}
62
+ {/*</View>*/}
63
+ {showBack && (
64
+ <TouchableOpacity style={styles.headerLeft} onPress={handleBack}>
65
+ <Image
66
+ source={
67
+ backTheme === 'black'
68
+ ? require('../../../assets/img/goBack.png')
69
+ : require('../../../assets/img/goBack2.png')
70
+ }
71
+ style={styles.goBackImg}
72
+ resizeMode="contain"
73
+ />
74
+ </TouchableOpacity>
75
+ )}
76
+ <Text style={[styles.titleStyle, titleStyle]} numberOfLines={1}>
77
+ {title}
78
+ </Text>
79
+ <View style={styles.headerRight}>{headerRight()}</View>
80
+ </View>
81
+ </>
82
+ );
83
+ };
84
+
85
+ const styles = StyleSheet.create({
86
+ header: {
87
+ flexDirection: 'row',
88
+ height: 50,
89
+ alignItems: 'center',
90
+ paddingHorizontal: px(44),
91
+ position: 'relative',
92
+ },
93
+ goBackImg: {
94
+ width: px(60),
95
+ height: px(60),
96
+ // transform: [
97
+ // {
98
+ // translateX: px(-25),
99
+ // },
100
+ // ],
101
+ },
102
+ headerLeft: {
103
+ flexDirection: 'row',
104
+ height: '100%',
105
+ alignItems: 'center',
106
+ paddingRight: px(50),
107
+ position: 'absolute',
108
+ top: 0,
109
+ bottom: 0,
110
+ left: px(24),
111
+ // backgroundColor: 'red',
112
+ zIndex: 1000,
113
+ },
114
+ backBtn: {
115
+ // marginLeft: 14,
116
+ },
117
+ headerTitle: {
118
+ flexDirection: 'row',
119
+ maxWidth: '60%',
120
+ alignItems: 'center',
121
+ },
122
+ titleStyle: {
123
+ fontSize: 18,
124
+ color: '#000',
125
+ fontWeight: 'bold',
126
+ marginRight: 3,
127
+ flex: 1,
128
+ textAlign: 'center',
129
+ },
130
+ headerRight: {
131
+ flexDirection: 'row',
132
+ // flex: 1,
133
+ height: '100%',
134
+ // paddingHorizontal: 14,
135
+ position: 'absolute',
136
+ top: 0,
137
+ bottom: 0,
138
+ right: px(44),
139
+ alignItems: 'center',
140
+ justifyContent: 'center',
141
+ },
142
+ });
143
+
144
+ export default Index;