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.
- package/app/.local_dev/DemoPage.js +46 -0
- package/app/.local_dev/env.js +1 -0
- package/app/.local_dev/polyfill.js +83 -0
- package/app/App.js +485 -0
- package/app/api/homedApi.js +42 -0
- package/app/api/index.js +2 -0
- package/app/api/ipanelCloudApi.js +796 -0
- package/app/assets/img/add.png +0 -0
- package/app/assets/img/add_img.png +0 -0
- package/app/assets/img/album.png +0 -0
- package/app/assets/img/album2.png +0 -0
- package/app/assets/img/album3.png +0 -0
- package/app/assets/img/album@2x.png +0 -0
- package/app/assets/img/album@3x.png +0 -0
- package/app/assets/img/audioRecordBar.png +0 -0
- package/app/assets/img/bootom_bar_bg.png +0 -0
- package/app/assets/img/close.png +0 -0
- package/app/assets/img/computer.png +0 -0
- package/app/assets/img/confirm.png +0 -0
- package/app/assets/img/delete_pic.png +0 -0
- package/app/assets/img/disabled.png +0 -0
- package/app/assets/img/goBack.png +0 -0
- package/app/assets/img/goBack2.png +0 -0
- package/app/assets/img/ischeck.png +0 -0
- package/app/assets/img/launch_bg.png +0 -0
- package/app/assets/img/launch_bg_panyu.png +0 -0
- package/app/assets/img/launch_logo.png +0 -0
- package/app/assets/img/launch_logo_panyu.png +0 -0
- package/app/assets/img/launch_text.png +0 -0
- package/app/assets/img/launch_text_panyu.png +0 -0
- package/app/assets/img/link.png +0 -0
- package/app/assets/img/login_bg.png +0 -0
- package/app/assets/img/login_bg_new.png +0 -0
- package/app/assets/img/login_left.png +0 -0
- package/app/assets/img/login_right.png +0 -0
- package/app/assets/img/nocheck.png +0 -0
- package/app/assets/img/personal.png +0 -0
- package/app/assets/img/photo.png +0 -0
- package/app/assets/img/photo@2x.png +0 -0
- package/app/assets/img/photo@3x.png +0 -0
- package/app/assets/img/protocol_checked.png +0 -0
- package/app/assets/img/qiehuan.png +0 -0
- package/app/assets/img/scan_border_bottom_left.png +0 -0
- package/app/assets/img/scan_border_bottom_right.png +0 -0
- package/app/assets/img/scan_border_top_left.png +0 -0
- package/app/assets/img/scan_border_top_right.png +0 -0
- package/app/assets/img/scan_move.png +0 -0
- package/app/assets/img/szjt.png +0 -0
- package/app/assets/img/tab.png +0 -0
- package/app/assets/img/tykz.png +0 -0
- package/app/assets/img/update_bg.png +0 -0
- package/app/assets/img/video.png +0 -0
- package/app/assets/img/video@2x.png +0 -0
- package/app/assets/img/video@3x.png +0 -0
- package/app/assets/img/worker.png +0 -0
- package/app/assets/img/wx.png +0 -0
- package/app/assets/img/ykq.png +0 -0
- package/app/assets/img/zfb.png +0 -0
- package/app/base.js +342 -0
- package/app/components/VersionUpdateConfirm.js +117 -0
- package/app/components/common/AccordionCell/index.js +67 -0
- package/app/components/common/ActionPicker/BasicPicker.js +136 -0
- package/app/components/common/ActionPicker/index.js +106 -0
- package/app/components/common/AddressPicker/index.js +211 -0
- package/app/components/common/Card/index.js +19 -0
- package/app/components/common/Cell/index.js +381 -0
- package/app/components/common/CustomDialog/index.js +120 -0
- package/app/components/common/CustomTabBar/index.js +157 -0
- package/app/components/common/CustomTabBar_bak/TabBarInput.js +210 -0
- package/app/components/common/CustomTabBar_bak/index.js +832 -0
- package/app/components/common/DateTimingPicker/index.js +254 -0
- package/app/components/common/Dialog/Notify.js +36 -0
- package/app/components/common/Dialog/baseDialog.js +146 -0
- package/app/components/common/Dialog/index.js +113 -0
- package/app/components/common/Dialog/prompt.js +145 -0
- package/app/components/common/Dialog/quickSelect.js +54 -0
- package/app/components/common/Dialog/select.js +125 -0
- package/app/components/common/Dialog/styles.js +167 -0
- package/app/components/common/Loading/index.js +71 -0
- package/app/components/common/LoginType/index.js +171 -0
- package/app/components/common/LoginType/protocol.js +160 -0
- package/app/components/common/Notify/index.js +68 -0
- package/app/components/common/OnceTouchable/index.js +33 -0
- package/app/components/common/PaymentPicker/index.js +264 -0
- package/app/components/common/ProductOrderPicker/index.js +524 -0
- package/app/components/common/ScreenBackHeader/index.js +144 -0
- package/app/components/common/ScrollPicker/index.js +232 -0
- package/app/components/common/SelectPicker/index.js +171 -0
- package/app/components/common/SmsCodeInput/index.js +93 -0
- package/app/components/common/SmsCodeInput/indexNew.js +101 -0
- package/app/components/common/Steps/index.js +126 -0
- package/app/components/common/Tag/index.js +17 -0
- package/app/components/common/Toast/index.js +103 -0
- package/app/components/common/WeekDaysPicker/index.js +196 -0
- package/app/components/index.js +8 -0
- package/app/components/iot/AddDeviceActionSheet/index.js +934 -0
- package/app/components/iot/AddressActionSheet/index.js +91 -0
- package/app/components/iot/RoomActionSheet/index.js +205 -0
- package/app/components/iot/ViewDeviceActionSheet/index.js +834 -0
- package/app/components/sheets.js +30 -0
- package/app/eventBus/index.js +54 -0
- package/app/hooks/checkLogin.js +30 -0
- package/app/hooks/shopMessageManager.js +308 -0
- package/app/hooks/useAddress.js +179 -0
- package/app/hooks/useAddress2.js +587 -0
- package/app/hooks/useDebounceFn.js +6 -0
- package/app/hooks/useDynamicPackages.js +22 -0
- package/app/hooks/useKeyboard.js +25 -0
- package/app/hooks/useLatest.js +10 -0
- package/app/hooks/useMessageManager.js +368 -0
- package/app/hooks/useNavigationFocus.js +19 -0
- package/app/hooks/useUser.js +56 -0
- package/app/screens/BaseScreen.js +389 -0
- package/app/screens/CommonScreens/BindPhoneScreen/index.js +179 -0
- package/app/screens/CommonScreens/BossScreen/index.js +138 -0
- package/app/screens/CommonScreens/DeviceAnswerDetailScreen/index.js +50 -0
- package/app/screens/CommonScreens/DeviceFeedbackScreen/index.js +365 -0
- package/app/screens/CommonScreens/EditInvoiceTitleScreen/index.js +279 -0
- package/app/screens/CommonScreens/FamilyDetailScreen/index.js +421 -0
- package/app/screens/CommonScreens/InvoiceTitleListScreen/index.js +118 -0
- package/app/screens/CommonScreens/OperatorSelectScreen/index.js +315 -0
- package/app/screens/CommonScreens/PersonalScreen/index.js +348 -0
- package/app/screens/CommonScreens/ScanQRCodeScreen/index.js +407 -0
- package/app/screens/CommonScreens/TvAlbumScreen/index.js +407 -0
- package/app/screens/LoginScreen/OpenLogSheet.js +241 -0
- package/app/screens/LoginScreen/index.js +920 -0
- package/app/screens/LoginScreen/indexNew.js +1354 -0
- package/app/screens/ResePassword/index.js +364 -0
- package/app/screens/SbkScreen.js +19 -0
- package/app/screens/WebviewScreen.js +41 -0
- package/app/storage/index.js +166 -0
- package/app/utils/EventEmitter.js +43 -0
- package/app/utils/RootNavigation.js +32 -0
- package/app/utils/SBK_plugin/convert.js +90 -0
- package/app/utils/SBK_plugin/convertStatus.js +250 -0
- package/app/utils/SBK_plugin/eventProcess.js +339 -0
- package/app/utils/SBK_plugin/index.js +32 -0
- package/app/utils/SBK_plugin/ipanelDeviceToSbkDevice.js +68 -0
- package/app/utils/SBK_plugin/sbk_defs.js +191 -0
- package/app/utils/StyleComposite.js +37 -0
- package/app/utils/applyPermissions.js +251 -0
- package/app/utils/bundleUpdater.js +46 -0
- package/app/utils/common.js +380 -0
- package/app/utils/config.js +47 -0
- package/app/utils/errCodes.js +3 -0
- package/app/utils/homedData.js +57 -0
- package/app/utils/http.js +178 -0
- package/app/utils/notice.js +15 -0
- package/app/utils/priceConversion.js +30 -0
- package/app/utils/registerDialog.js +90 -0
- package/app/utils/scaleSize.js +12 -0
- package/app/utils/soundPlayer.js +85 -0
- package/bin/local-dev.js +7 -0
- package/index.js +8 -0
- package/package.json +18 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View, Text, StyleSheet, TouchableOpacity} from 'react-native';
|
|
3
|
+
import ActionSheet from 'react-native-actions-sheet';
|
|
4
|
+
import Picker from 'react-native-wheel-picker';
|
|
5
|
+
var PickerItem = Picker.Item;
|
|
6
|
+
|
|
7
|
+
const BasicPicker = ({
|
|
8
|
+
sheetId,
|
|
9
|
+
title = '',
|
|
10
|
+
cancelBtnText = '取消',
|
|
11
|
+
confirmBtnText = '确定',
|
|
12
|
+
columns = [],
|
|
13
|
+
onCancel,
|
|
14
|
+
onConfirm,
|
|
15
|
+
selectedIndex,
|
|
16
|
+
setSelectedIndex,
|
|
17
|
+
onValueChange,
|
|
18
|
+
...leftProps
|
|
19
|
+
}) => {
|
|
20
|
+
if (!Array.isArray(selectedIndex) || !Array.isArray(columns)) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
"BasicPicker's prop 'selectedIndex' or 'columns' required a array",
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const handleCancel = () => {
|
|
27
|
+
onCancel && onCancel(selectedIndex);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleConfirm = () => {
|
|
31
|
+
onConfirm && onConfirm(selectedIndex);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleValueChange = (i, index) => {
|
|
35
|
+
const indexes = [...selectedIndex];
|
|
36
|
+
indexes[i] = index;
|
|
37
|
+
setSelectedIndex && setSelectedIndex(indexes);
|
|
38
|
+
onValueChange && onValueChange(i, index, indexes);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
<ActionSheet
|
|
44
|
+
id={sheetId}
|
|
45
|
+
isModal={false}
|
|
46
|
+
useBottomSafeAreaPadding
|
|
47
|
+
{...leftProps}>
|
|
48
|
+
<View style={styles.title}>
|
|
49
|
+
<TouchableOpacity
|
|
50
|
+
style={styles.cancelBtnBox}
|
|
51
|
+
activeOpacity={0.3}
|
|
52
|
+
onPress={handleCancel}>
|
|
53
|
+
<Text style={styles.cancnelBtnText}>{cancelBtnText}</Text>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
<Text style={styles.titleText}>{title}</Text>
|
|
56
|
+
<TouchableOpacity
|
|
57
|
+
style={styles.confirmBtnBox}
|
|
58
|
+
activeOpacity={0.3}
|
|
59
|
+
onPress={handleConfirm}>
|
|
60
|
+
<Text style={styles.confirmBtnText}>{confirmBtnText}</Text>
|
|
61
|
+
</TouchableOpacity>
|
|
62
|
+
</View>
|
|
63
|
+
|
|
64
|
+
<View style={styles.pickerBox}>
|
|
65
|
+
{columns.map((subColumns, i) => {
|
|
66
|
+
return (
|
|
67
|
+
<Picker
|
|
68
|
+
style={styles.picker}
|
|
69
|
+
key={i}
|
|
70
|
+
selectedValue={selectedIndex[i]}
|
|
71
|
+
itemStyle={{color: '#000', fontSize: 20}}
|
|
72
|
+
itemSpace={36}
|
|
73
|
+
onValueChange={index => handleValueChange(i, index)}>
|
|
74
|
+
{subColumns.map((value, j) => (
|
|
75
|
+
<PickerItem label={value} value={j} key={value} />
|
|
76
|
+
))}
|
|
77
|
+
</Picker>
|
|
78
|
+
);
|
|
79
|
+
})}
|
|
80
|
+
</View>
|
|
81
|
+
</ActionSheet>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const styles = StyleSheet.create({
|
|
87
|
+
title: {
|
|
88
|
+
position: 'relative',
|
|
89
|
+
height: 50,
|
|
90
|
+
paddingHorizontal: 60,
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
},
|
|
94
|
+
titleText: {
|
|
95
|
+
fontSize: 18,
|
|
96
|
+
color: '#333',
|
|
97
|
+
},
|
|
98
|
+
cancelBtnBox: {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
height: '100%',
|
|
101
|
+
top: 0,
|
|
102
|
+
left: 0,
|
|
103
|
+
width: 60,
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
},
|
|
107
|
+
confirmBtnBox: {
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
height: '100%',
|
|
110
|
+
top: 0,
|
|
111
|
+
right: 0,
|
|
112
|
+
width: 60,
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
justifyContent: 'center',
|
|
115
|
+
},
|
|
116
|
+
cancnelBtnText: {
|
|
117
|
+
fontSize: 18,
|
|
118
|
+
},
|
|
119
|
+
confirmBtnText: {
|
|
120
|
+
fontSize: 18,
|
|
121
|
+
color: '#2089dc',
|
|
122
|
+
},
|
|
123
|
+
pickerBox: {
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
justifyContent: 'center',
|
|
126
|
+
backgroundColor: '#fefefe',
|
|
127
|
+
flexDirection: 'row',
|
|
128
|
+
marginTop: 20,
|
|
129
|
+
},
|
|
130
|
+
picker: {
|
|
131
|
+
flex: 1,
|
|
132
|
+
height: 180,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export default BasicPicker;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import {StyleSheet} from 'react-native';
|
|
3
|
+
import {SheetProps, SheetManager} from 'react-native-actions-sheet';
|
|
4
|
+
import BasicPicker from './BasicPicker';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* columns格式:
|
|
8
|
+
* 普通一级picker:[{name: "xx"}, {name: "yy"}]
|
|
9
|
+
* 级联多级picker:[{name: "xx", children: []}, {name: "yy", children:[]}]
|
|
10
|
+
*/
|
|
11
|
+
const Index = (props: SheetProps) => {
|
|
12
|
+
let depth = props.payload.depth || 1;
|
|
13
|
+
|
|
14
|
+
const dataListToNameList = dataList => {
|
|
15
|
+
return dataList.map(item => item[props.payload.nameProp || 'name']);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const genColumnsByIndexPath = indexes => {
|
|
19
|
+
return new Array(depth).fill().map((slot, columnIndex) => {
|
|
20
|
+
if (columnIndex === 0) {
|
|
21
|
+
return props.payload.columns;
|
|
22
|
+
} else {
|
|
23
|
+
const prevColumnIndex = indexes[columnIndex - 1];
|
|
24
|
+
const prevColumn = props.payload.columns[prevColumnIndex];
|
|
25
|
+
return prevColumn.children || [];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// index统一转数组处理
|
|
31
|
+
let defaultIndex = props.payload.defaultIndex;
|
|
32
|
+
if (typeof props.payload.defaultIndex === 'undefined') {
|
|
33
|
+
defaultIndex = new Array(depth).fill(0);
|
|
34
|
+
} else if (!Array.isArray(defaultIndex)) {
|
|
35
|
+
defaultIndex = [defaultIndex];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let columns = [];
|
|
39
|
+
if (depth === 1) {
|
|
40
|
+
// 普通的单层picker
|
|
41
|
+
columns = [dataListToNameList(props.payload.columns)];
|
|
42
|
+
} else {
|
|
43
|
+
// 级联picker
|
|
44
|
+
columns = genColumnsByIndexPath(defaultIndex).map(cols =>
|
|
45
|
+
dataListToNameList(cols),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const [columnList, setColumnList] = useState(columns);
|
|
50
|
+
const [selectedIndex, setSelectedIndex] = useState(defaultIndex);
|
|
51
|
+
|
|
52
|
+
const handleCancel = index => {
|
|
53
|
+
SheetManager.hide(props.sheetId);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleConfirm = index => {
|
|
57
|
+
let data;
|
|
58
|
+
const columnOriginDataList = genColumnsByIndexPath(index);
|
|
59
|
+
if (index.length === 1) {
|
|
60
|
+
data = props.payload.columns[index[0]];
|
|
61
|
+
} else {
|
|
62
|
+
data = index.map((idx, i) => columnOriginDataList[i][idx]);
|
|
63
|
+
}
|
|
64
|
+
index = index.length > 1 ? index : index[0];
|
|
65
|
+
|
|
66
|
+
// console.log(index, data);
|
|
67
|
+
|
|
68
|
+
SheetManager.hide(props.sheetId, {
|
|
69
|
+
payload: {
|
|
70
|
+
index,
|
|
71
|
+
data,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleValueChange = (columnIndex, valueIndex, indexes) => {
|
|
77
|
+
indexes = [...indexes];
|
|
78
|
+
indexes[columnIndex] = valueIndex;
|
|
79
|
+
let idx = columnIndex + 1;
|
|
80
|
+
while (typeof indexes[idx] !== 'undefined') {
|
|
81
|
+
indexes[idx] = 0;
|
|
82
|
+
idx++;
|
|
83
|
+
}
|
|
84
|
+
const colList = genColumnsByIndexPath(indexes).map(cols =>
|
|
85
|
+
dataListToNameList(cols),
|
|
86
|
+
);
|
|
87
|
+
setColumnList(colList);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<BasicPicker
|
|
92
|
+
sheetId={props.sheetId}
|
|
93
|
+
title={props.payload.title}
|
|
94
|
+
columns={columnList}
|
|
95
|
+
selectedIndex={selectedIndex}
|
|
96
|
+
setSelectedIndex={setSelectedIndex}
|
|
97
|
+
onValueChange={handleValueChange}
|
|
98
|
+
onCancel={handleCancel}
|
|
99
|
+
onConfirm={handleConfirm}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const styles = StyleSheet.create({});
|
|
105
|
+
|
|
106
|
+
export default Index;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, Image } from "react-native";
|
|
3
|
+
import ActionSheet, { SheetManager } from "react-native-actions-sheet";
|
|
4
|
+
import px from "../../../utils/scaleSize";
|
|
5
|
+
import { getRegionList } from "../../../api";
|
|
6
|
+
import { ScrollView } from "react-native";
|
|
7
|
+
|
|
8
|
+
const Index = ({ sheetId, payload }) => {
|
|
9
|
+
const { parent = 86, handelSelectRegion } = payload;
|
|
10
|
+
|
|
11
|
+
// 这里不用写四个列表
|
|
12
|
+
const [provinceList, setProvinceList] = useState([]); // 省份列表
|
|
13
|
+
const [cityList, setCityList] = useState([]); // 市级列表
|
|
14
|
+
const [areaList, setAreaList] = useState([]); // 区列表
|
|
15
|
+
const [streetList, setStreetList] = useState([]); // 街道列表
|
|
16
|
+
|
|
17
|
+
const selectTypeRef = useRef(0); // 0还没选,1省, 2市,3区,4街道
|
|
18
|
+
const parentRef = useRef(parent);
|
|
19
|
+
const [region, setRegion] = useState([]);
|
|
20
|
+
const [selectType, setSelectType] = useState(0);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
getRegion();
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
const getRegion = () => {
|
|
27
|
+
if (selectTypeRef.current === 4) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
getRegionList({
|
|
31
|
+
parent: parentRef.current,
|
|
32
|
+
pageidx: 1,
|
|
33
|
+
pagenum: 200,
|
|
34
|
+
}).then((res) => {
|
|
35
|
+
if (parentRef.current === 86) {
|
|
36
|
+
selectTypeRef.current = 0;
|
|
37
|
+
setProvinceList(res.region_list || []);
|
|
38
|
+
} else if (selectTypeRef.current === 1) {
|
|
39
|
+
setCityList(res.region_list || []);
|
|
40
|
+
} else if (selectTypeRef.current === 2) {
|
|
41
|
+
setAreaList(res.region_list || []);
|
|
42
|
+
} else {
|
|
43
|
+
setStreetList(res.region_list || []);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const selectRegion = (type, item) => {
|
|
49
|
+
console.log(type, item);
|
|
50
|
+
selectTypeRef.current = item.child;
|
|
51
|
+
setSelectType(item.child);
|
|
52
|
+
parentRef.current = item.code;
|
|
53
|
+
let re = JSON.parse(JSON.stringify(region));
|
|
54
|
+
if (item.child === 1) {
|
|
55
|
+
re = [];
|
|
56
|
+
re.push(item);
|
|
57
|
+
} else {
|
|
58
|
+
re[item.child - 1] = item;
|
|
59
|
+
re.splice(item.child);
|
|
60
|
+
}
|
|
61
|
+
setRegion([...re]);
|
|
62
|
+
if (item.child !== 4) {
|
|
63
|
+
getRegion();
|
|
64
|
+
} else {
|
|
65
|
+
// 选了第四个后回调
|
|
66
|
+
handelSelectRegion([...re]);
|
|
67
|
+
handleConfirm();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const changeRegion = (index) => {
|
|
72
|
+
setSelectType(index);
|
|
73
|
+
selectTypeRef.current = index;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleConfirm = () => {
|
|
77
|
+
SheetManager.hide(sheetId);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const handleCancel = () => {
|
|
81
|
+
SheetManager.hide(sheetId);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<ActionSheet id={sheetId} isModal={false}>
|
|
87
|
+
<View style={styles.content}>
|
|
88
|
+
<Text style={styles.title}>选择地区</Text>
|
|
89
|
+
{/* 已选择 */}
|
|
90
|
+
<View style={styles.row}>
|
|
91
|
+
{region.length > 0 && (
|
|
92
|
+
<TouchableOpacity onPress={() => changeRegion(0)}>
|
|
93
|
+
<Text style={styles.selectTitle}>{region[0]?.name}</Text>
|
|
94
|
+
</TouchableOpacity>
|
|
95
|
+
)}
|
|
96
|
+
{region.length > 1 && (
|
|
97
|
+
<TouchableOpacity onPress={() => changeRegion(1)}>
|
|
98
|
+
<Text style={styles.selectTitle}>{region[1]?.name}</Text>
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
)}
|
|
101
|
+
{region.length > 2 && (
|
|
102
|
+
<TouchableOpacity onPress={() => changeRegion(2)}>
|
|
103
|
+
<Text style={styles.selectTitle}>{region[2]?.name}</Text>
|
|
104
|
+
</TouchableOpacity>
|
|
105
|
+
)}
|
|
106
|
+
{region.length > 3 && (
|
|
107
|
+
<TouchableOpacity onPress={() => changeRegion(3)}>
|
|
108
|
+
<Text style={styles.selectTitle}>{region[3]?.name}</Text>
|
|
109
|
+
</TouchableOpacity>
|
|
110
|
+
)}
|
|
111
|
+
{region.length === 4 && (
|
|
112
|
+
<Text style={styles.selectTitle}>请选择</Text>
|
|
113
|
+
)}
|
|
114
|
+
</View>
|
|
115
|
+
{/* 地区列表 */}
|
|
116
|
+
<RegionList
|
|
117
|
+
type={selectTypeRef.current}
|
|
118
|
+
provinceList={provinceList}
|
|
119
|
+
cityList={cityList}
|
|
120
|
+
areaList={areaList}
|
|
121
|
+
streetList={streetList}
|
|
122
|
+
selectRegion={selectRegion}
|
|
123
|
+
/>
|
|
124
|
+
<TouchableOpacity style={styles.closeBox} onPress={handleCancel}>
|
|
125
|
+
<Image
|
|
126
|
+
source={require("../../../assets/img/close.png")}
|
|
127
|
+
style={styles.closeImg}
|
|
128
|
+
/>
|
|
129
|
+
</TouchableOpacity>
|
|
130
|
+
</View>
|
|
131
|
+
</ActionSheet>
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const RegionList = ({
|
|
137
|
+
type,
|
|
138
|
+
streetList,
|
|
139
|
+
areaList,
|
|
140
|
+
cityList,
|
|
141
|
+
provinceList,
|
|
142
|
+
selectRegion,
|
|
143
|
+
}) => {
|
|
144
|
+
const list =
|
|
145
|
+
type === 0
|
|
146
|
+
? provinceList
|
|
147
|
+
: type === 1
|
|
148
|
+
? cityList
|
|
149
|
+
: type === 2
|
|
150
|
+
? areaList
|
|
151
|
+
: streetList;
|
|
152
|
+
return (
|
|
153
|
+
<View style={styles.regionStyle}>
|
|
154
|
+
<ScrollView showsVerticalScrollIndicator={false}>
|
|
155
|
+
{list.length ? (
|
|
156
|
+
list.map((item) => (
|
|
157
|
+
<TouchableOpacity
|
|
158
|
+
onPress={() => selectRegion(type, item)}
|
|
159
|
+
key={item.code}
|
|
160
|
+
>
|
|
161
|
+
<Text style={styles.region}>{item.name}</Text>
|
|
162
|
+
</TouchableOpacity>
|
|
163
|
+
))
|
|
164
|
+
) : (
|
|
165
|
+
<Text style={styles.region}>暂无数据</Text>
|
|
166
|
+
)}
|
|
167
|
+
</ScrollView>
|
|
168
|
+
</View>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const styles = StyleSheet.create({
|
|
173
|
+
content: {
|
|
174
|
+
paddingHorizontal: px(55),
|
|
175
|
+
paddingTop: px(38),
|
|
176
|
+
position: "relative",
|
|
177
|
+
backgroundColor: "#fff",
|
|
178
|
+
},
|
|
179
|
+
title: {
|
|
180
|
+
fontSize: px(44),
|
|
181
|
+
color: "#333",
|
|
182
|
+
textAlign: "center",
|
|
183
|
+
marginBottom: px(55),
|
|
184
|
+
},
|
|
185
|
+
row: {
|
|
186
|
+
flexDirection: "row",
|
|
187
|
+
},
|
|
188
|
+
selectTitle: {
|
|
189
|
+
color: "#EA6000",
|
|
190
|
+
marginRight: px(30),
|
|
191
|
+
},
|
|
192
|
+
closeBox: {
|
|
193
|
+
position: "absolute",
|
|
194
|
+
top: px(36),
|
|
195
|
+
right: px(44),
|
|
196
|
+
},
|
|
197
|
+
closeImg: {
|
|
198
|
+
width: px(70),
|
|
199
|
+
height: px(70),
|
|
200
|
+
},
|
|
201
|
+
regionStyle: {
|
|
202
|
+
height: px(800),
|
|
203
|
+
marginTop: px(33),
|
|
204
|
+
},
|
|
205
|
+
region: {
|
|
206
|
+
color: "#333",
|
|
207
|
+
marginBottom: px(33),
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
export default Index;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Text, StyleSheet, View} from 'react-native';
|
|
3
|
+
import {Icon} from '@rneui/themed';
|
|
4
|
+
|
|
5
|
+
const Index = ({style, children}) => {
|
|
6
|
+
return <View style={[styles.container, style]}>{children}</View>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
padding: 10,
|
|
12
|
+
borderWidth: 1,
|
|
13
|
+
borderStyle: 'solid',
|
|
14
|
+
borderColor: '#ebeef5',
|
|
15
|
+
borderRadius: 5,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default Index;
|