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,381 @@
|
|
|
1
|
+
import React, {useRef, useState} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TextInput,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TouchableHighlight,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
Platform,
|
|
10
|
+
Image,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import {Icon, Switch, Slider, ButtonGroup} from '@rneui/themed';
|
|
13
|
+
import px from '../../../utils/scaleSize';
|
|
14
|
+
|
|
15
|
+
const Index = ({
|
|
16
|
+
type = 'text',
|
|
17
|
+
label = '',
|
|
18
|
+
leftComponent,
|
|
19
|
+
value,
|
|
20
|
+
style = {},
|
|
21
|
+
inputIcon,
|
|
22
|
+
sliderOptions,
|
|
23
|
+
enumButtons,
|
|
24
|
+
onChangeText,
|
|
25
|
+
onValueChange,
|
|
26
|
+
placeholder = '',
|
|
27
|
+
onRightPress,
|
|
28
|
+
required = false,
|
|
29
|
+
rightComponent,
|
|
30
|
+
valueTextStyle,
|
|
31
|
+
// 左边样式
|
|
32
|
+
labelStyle,
|
|
33
|
+
// 左边label
|
|
34
|
+
labelTextStyle,
|
|
35
|
+
editable = true,
|
|
36
|
+
multiline = true,
|
|
37
|
+
inputRef,
|
|
38
|
+
onSubmitEditing,
|
|
39
|
+
keyboardType,
|
|
40
|
+
maxLength,
|
|
41
|
+
onBlur,
|
|
42
|
+
onRightLongPress,
|
|
43
|
+
returnKeyType,
|
|
44
|
+
border = true,
|
|
45
|
+
}) => {
|
|
46
|
+
// 是否在编辑模式
|
|
47
|
+
const [editMode, setEditMode] = useState(false);
|
|
48
|
+
|
|
49
|
+
return React.createElement(type === 'link' ? TouchableOpacity : View, {
|
|
50
|
+
style: [
|
|
51
|
+
styles.container,
|
|
52
|
+
{
|
|
53
|
+
borderBottomWidth: border ? 0.4 : 0,
|
|
54
|
+
},
|
|
55
|
+
style,
|
|
56
|
+
],
|
|
57
|
+
onPress: onRightPress,
|
|
58
|
+
onLongPress: onRightLongPress,
|
|
59
|
+
children: (
|
|
60
|
+
<>
|
|
61
|
+
{!!leftComponent && <View>{leftComponent}</View>}
|
|
62
|
+
{!!label && (
|
|
63
|
+
<View style={[styles.labelBox, labelStyle]}>
|
|
64
|
+
<Text style={styles.requiredFlag}>{required ? '*' : ''}</Text>
|
|
65
|
+
<Text style={[styles.label, labelTextStyle]} numberOfLines={1}>
|
|
66
|
+
{label}
|
|
67
|
+
</Text>
|
|
68
|
+
</View>
|
|
69
|
+
)}
|
|
70
|
+
{type === 'input' ? (
|
|
71
|
+
<View
|
|
72
|
+
style={[styles.valueBox, styles.inputBox]}
|
|
73
|
+
onPress={onRightPress}
|
|
74
|
+
activeOpacity={0.9}
|
|
75
|
+
underlayColor="#fcfcfc">
|
|
76
|
+
<TextInput
|
|
77
|
+
ref={inputRef}
|
|
78
|
+
value={value}
|
|
79
|
+
multiline={multiline}
|
|
80
|
+
style={styles.valueInput}
|
|
81
|
+
placeholder={placeholder}
|
|
82
|
+
placeholdertextcolor="#999"
|
|
83
|
+
onChangeText={onChangeText}
|
|
84
|
+
editable={editable}
|
|
85
|
+
keyboardType={keyboardType}
|
|
86
|
+
maxLength={maxLength}
|
|
87
|
+
returnKeyType={returnKeyType}
|
|
88
|
+
/>
|
|
89
|
+
<View style={styles.inputIconBox}>{inputIcon}</View>
|
|
90
|
+
</View>
|
|
91
|
+
) : type === 'link' ? (
|
|
92
|
+
<View
|
|
93
|
+
style={styles.valueBox}
|
|
94
|
+
onPress={onRightPress}
|
|
95
|
+
activeOpacity={0.9}
|
|
96
|
+
underlayColor="#f5f5f5">
|
|
97
|
+
<View style={styles.valueLink}>
|
|
98
|
+
<View style={styles.linkLeftText}>
|
|
99
|
+
<Text
|
|
100
|
+
style={[styles.valueLinkText, valueTextStyle]}
|
|
101
|
+
numberOfLines={1}>
|
|
102
|
+
{value}
|
|
103
|
+
</Text>
|
|
104
|
+
</View>
|
|
105
|
+
<View style={styles.linkRightIcon}>
|
|
106
|
+
{/*<Icon*/}
|
|
107
|
+
{/* name="chevron-right"*/}
|
|
108
|
+
{/* type="material"*/}
|
|
109
|
+
{/* size={20}*/}
|
|
110
|
+
{/* color="#aaa"*/}
|
|
111
|
+
{/*/>*/}
|
|
112
|
+
<Image
|
|
113
|
+
source={require('../../../assets/img/link.png')}
|
|
114
|
+
style={{
|
|
115
|
+
width: px(30),
|
|
116
|
+
height: px(30),
|
|
117
|
+
}}
|
|
118
|
+
resizeMode="contain"
|
|
119
|
+
/>
|
|
120
|
+
</View>
|
|
121
|
+
</View>
|
|
122
|
+
</View>
|
|
123
|
+
) : type === 'switch' ? (
|
|
124
|
+
<View
|
|
125
|
+
style={styles.valueBox}
|
|
126
|
+
onPress={onRightPress}
|
|
127
|
+
activeOpacity={0.9}
|
|
128
|
+
underlayColor="#f1f1f1">
|
|
129
|
+
<Switch
|
|
130
|
+
style={styles.switchStyle}
|
|
131
|
+
value={value}
|
|
132
|
+
onValueChange={onValueChange}
|
|
133
|
+
thumbColor="#fff"
|
|
134
|
+
/>
|
|
135
|
+
</View>
|
|
136
|
+
) : type === 'slider' ? (
|
|
137
|
+
<View
|
|
138
|
+
style={styles.valueBox}
|
|
139
|
+
onPress={onRightPress}
|
|
140
|
+
activeOpacity={0.9}
|
|
141
|
+
underlayColor="#f1f1f1">
|
|
142
|
+
<View style={styles.sliderBox}>
|
|
143
|
+
<View style={styles.sliderContainer}>
|
|
144
|
+
<Slider
|
|
145
|
+
maximumTrackTintColor="#d9d9d9"
|
|
146
|
+
maximumValue={sliderOptions.max || 100}
|
|
147
|
+
minimumTrackTintColor={
|
|
148
|
+
sliderOptions.minimumTrackTintColor || '#00beb5'
|
|
149
|
+
}
|
|
150
|
+
minimumValue={sliderOptions.min || 0}
|
|
151
|
+
disabled={sliderOptions.disabled || false}
|
|
152
|
+
onSlidingComplete={sliderOptions.onSlidingComplete}
|
|
153
|
+
onSlidingStart={sliderOptions.onSlidingStart}
|
|
154
|
+
onValueChange={sliderOptions.onValueChange}
|
|
155
|
+
orientation="horizontal"
|
|
156
|
+
step={1}
|
|
157
|
+
style={{width: '100%', height: 20}}
|
|
158
|
+
thumbStyle={{
|
|
159
|
+
height: px(33),
|
|
160
|
+
width: px(33),
|
|
161
|
+
borderWidth: 1,
|
|
162
|
+
borderColor: '#ccc',
|
|
163
|
+
}}
|
|
164
|
+
thumbTintColor={sliderOptions.thumbTintColor || '#0c0'}
|
|
165
|
+
thumbTouchSize={{width: 40, height: 40}}
|
|
166
|
+
trackStyle={{height: px(16), borderRadius: px(8)}}
|
|
167
|
+
value={value}
|
|
168
|
+
/>
|
|
169
|
+
<View
|
|
170
|
+
style={{
|
|
171
|
+
flexDirection: 'row',
|
|
172
|
+
justifyContent: 'space-between',
|
|
173
|
+
}}>
|
|
174
|
+
{(sliderOptions.progressLabels || []).map((item, index) => (
|
|
175
|
+
<Text
|
|
176
|
+
key={index}
|
|
177
|
+
style={{
|
|
178
|
+
color: '#666',
|
|
179
|
+
fontSize: px(38),
|
|
180
|
+
}}>
|
|
181
|
+
{item}
|
|
182
|
+
</Text>
|
|
183
|
+
))}
|
|
184
|
+
</View>
|
|
185
|
+
</View>
|
|
186
|
+
<View style={styles.sliderLabelBox}>
|
|
187
|
+
<Text style={styles.sliderLabel}>{value}</Text>
|
|
188
|
+
</View>
|
|
189
|
+
</View>
|
|
190
|
+
</View>
|
|
191
|
+
) : type === 'enum' ? (
|
|
192
|
+
<View
|
|
193
|
+
style={styles.valueBox}
|
|
194
|
+
onPress={onRightPress}
|
|
195
|
+
activeOpacity={0.9}
|
|
196
|
+
underlayColor="#f1f1f1">
|
|
197
|
+
<ButtonGroup
|
|
198
|
+
buttons={enumButtons}
|
|
199
|
+
selectedIndex={value}
|
|
200
|
+
onPress={value => {
|
|
201
|
+
onValueChange(value);
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
</View>
|
|
205
|
+
) : type === 'custom' ? (
|
|
206
|
+
<View style={styles.valueBox}>{rightComponent}</View>
|
|
207
|
+
) : type === 'edit' ? (
|
|
208
|
+
editMode ? (
|
|
209
|
+
<View style={[styles.valueBox, styles.inputBox]}>
|
|
210
|
+
<TextInput
|
|
211
|
+
ref={ref => {
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
ref?.focus();
|
|
214
|
+
}, 100);
|
|
215
|
+
}}
|
|
216
|
+
value={value}
|
|
217
|
+
multiline={false}
|
|
218
|
+
style={styles.valueInput}
|
|
219
|
+
placeholder={placeholder}
|
|
220
|
+
placeholdertextcolor="#999"
|
|
221
|
+
onChangeText={onChangeText}
|
|
222
|
+
returnKeyType="done"
|
|
223
|
+
onSubmitEditing={({nativeEvent}) => {
|
|
224
|
+
setEditMode(false);
|
|
225
|
+
onSubmitEditing && onSubmitEditing(nativeEvent.text);
|
|
226
|
+
}}
|
|
227
|
+
onBlur={(...args) => {
|
|
228
|
+
setEditMode(false);
|
|
229
|
+
onBlur && onBlur(...args);
|
|
230
|
+
}}
|
|
231
|
+
editable={editable}
|
|
232
|
+
keyboardType={keyboardType}
|
|
233
|
+
/>
|
|
234
|
+
<View style={styles.inputIconBox}>{inputIcon}</View>
|
|
235
|
+
</View>
|
|
236
|
+
) : (
|
|
237
|
+
<TouchableOpacity
|
|
238
|
+
style={styles.valueBox}
|
|
239
|
+
onPress={() => {
|
|
240
|
+
setEditMode(true);
|
|
241
|
+
}}
|
|
242
|
+
activeOpacity={0.9}
|
|
243
|
+
underlayColor="#f1f1f1">
|
|
244
|
+
<Text style={[styles.valueText, valueTextStyle]} selectable>
|
|
245
|
+
{value}
|
|
246
|
+
</Text>
|
|
247
|
+
</TouchableOpacity>
|
|
248
|
+
)
|
|
249
|
+
) : (
|
|
250
|
+
<View
|
|
251
|
+
style={styles.valueBox}
|
|
252
|
+
onPress={onRightPress}
|
|
253
|
+
activeOpacity={0.9}
|
|
254
|
+
underlayColor="#f1f1f1">
|
|
255
|
+
<Text style={[styles.valueText, valueTextStyle]} selectable>
|
|
256
|
+
{value}
|
|
257
|
+
</Text>
|
|
258
|
+
</View>
|
|
259
|
+
)}
|
|
260
|
+
</>
|
|
261
|
+
),
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const styles = StyleSheet.create({
|
|
266
|
+
container: {
|
|
267
|
+
flexDirection: 'row',
|
|
268
|
+
minHeight: 55,
|
|
269
|
+
borderBottomColor: '#f0f0f0',
|
|
270
|
+
},
|
|
271
|
+
labelBox: {
|
|
272
|
+
// flex: 1,
|
|
273
|
+
width: px(500),
|
|
274
|
+
alignItems: 'center',
|
|
275
|
+
paddingLeft: px(38) - 10,
|
|
276
|
+
flexDirection: 'row',
|
|
277
|
+
},
|
|
278
|
+
requiredFlag: {
|
|
279
|
+
color: '#E32929',
|
|
280
|
+
fontSize: 16,
|
|
281
|
+
width: 10,
|
|
282
|
+
},
|
|
283
|
+
label: {
|
|
284
|
+
fontSize: px(49),
|
|
285
|
+
color: '#333',
|
|
286
|
+
fontWeight: '400',
|
|
287
|
+
},
|
|
288
|
+
valueBox: {
|
|
289
|
+
flex: 1,
|
|
290
|
+
justifyContent: 'center',
|
|
291
|
+
alignItems: 'flex-end',
|
|
292
|
+
},
|
|
293
|
+
switchStyle: {
|
|
294
|
+
...Platform.select({
|
|
295
|
+
android: {
|
|
296
|
+
marginRight: 20,
|
|
297
|
+
transform: [
|
|
298
|
+
{
|
|
299
|
+
scaleX: 1.1,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
scaleY: 1.1,
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
ios: {
|
|
307
|
+
marginRight: 10,
|
|
308
|
+
transform: [
|
|
309
|
+
{
|
|
310
|
+
scaleX: 0.7,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
scaleY: 0.7,
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
}),
|
|
318
|
+
},
|
|
319
|
+
sliderBox: {
|
|
320
|
+
flexDirection: 'row',
|
|
321
|
+
alignItems: 'center',
|
|
322
|
+
},
|
|
323
|
+
sliderContainer: {
|
|
324
|
+
flex: 1,
|
|
325
|
+
},
|
|
326
|
+
sliderLabelBox: {
|
|
327
|
+
width: 40,
|
|
328
|
+
alignItems: 'center',
|
|
329
|
+
},
|
|
330
|
+
sliderLabel: {
|
|
331
|
+
fontSize: 16,
|
|
332
|
+
},
|
|
333
|
+
inputBox: {
|
|
334
|
+
flexDirection: 'row',
|
|
335
|
+
alignItems: 'center',
|
|
336
|
+
},
|
|
337
|
+
valueInput: {
|
|
338
|
+
flex: 1,
|
|
339
|
+
textAlign: 'right',
|
|
340
|
+
fontSize: px(44),
|
|
341
|
+
color: '#666',
|
|
342
|
+
backgroundColor: '#fff',
|
|
343
|
+
paddingRight: px(44),
|
|
344
|
+
height: '100%',
|
|
345
|
+
fontWeight: '400',
|
|
346
|
+
},
|
|
347
|
+
inputIconBox: {
|
|
348
|
+
alignItems: 'center',
|
|
349
|
+
justifyContent: 'center',
|
|
350
|
+
},
|
|
351
|
+
valueLink: {
|
|
352
|
+
flexDirection: 'row',
|
|
353
|
+
paddingRight: px(44),
|
|
354
|
+
},
|
|
355
|
+
linkLeftText: {
|
|
356
|
+
flex: 1,
|
|
357
|
+
},
|
|
358
|
+
linkRightIcon: {
|
|
359
|
+
width: 20,
|
|
360
|
+
alignItems: 'center',
|
|
361
|
+
justifyContent: 'center',
|
|
362
|
+
// marginLeft: 10,
|
|
363
|
+
},
|
|
364
|
+
valueText: {
|
|
365
|
+
textAlign: 'right',
|
|
366
|
+
fontSize: px(44),
|
|
367
|
+
color: '#666',
|
|
368
|
+
fontWeight: '400',
|
|
369
|
+
lineHeight: 24,
|
|
370
|
+
paddingRight: px(44),
|
|
371
|
+
},
|
|
372
|
+
valueLinkText: {
|
|
373
|
+
textAlign: 'right',
|
|
374
|
+
fontSize: px(44),
|
|
375
|
+
color: '#666',
|
|
376
|
+
fontWeight: '400',
|
|
377
|
+
lineHeight: 24,
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
export default Index;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {View, StyleSheet, TouchableOpacity} from 'react-native';
|
|
2
|
+
import {Text, Divider} from '@rneui/themed';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import px from '../../../utils/scaleSize';
|
|
5
|
+
import {fontStyle} from '../../../utils/StyleComposite';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 自定义组件式dialog组件,必须放在页面根组件下,内容通过插槽传入
|
|
9
|
+
* @param onVisibleChange Function 控制显示和隐藏
|
|
10
|
+
* @param onConfirm Function 确定按钮回调
|
|
11
|
+
* @param children JSX.Element 内容插槽
|
|
12
|
+
* @param title String 标题
|
|
13
|
+
* @param button JSX.Element
|
|
14
|
+
* @returns {JSX.Element}
|
|
15
|
+
*/
|
|
16
|
+
export default ({
|
|
17
|
+
onVisibleChange,
|
|
18
|
+
onConfirm,
|
|
19
|
+
children,
|
|
20
|
+
title,
|
|
21
|
+
customButton = false,
|
|
22
|
+
contentStyle = {},
|
|
23
|
+
}) => {
|
|
24
|
+
const handlerConfirm = () => {
|
|
25
|
+
onConfirm && onConfirm();
|
|
26
|
+
};
|
|
27
|
+
return (
|
|
28
|
+
<TouchableOpacity
|
|
29
|
+
activeOpacity={1}
|
|
30
|
+
style={styles.mask}
|
|
31
|
+
onPress={() => {
|
|
32
|
+
onVisibleChange(false);
|
|
33
|
+
}}>
|
|
34
|
+
<TouchableOpacity style={styles.container} activeOpacity={1}>
|
|
35
|
+
{!!title && (
|
|
36
|
+
<View style={styles.title}>
|
|
37
|
+
<Text style={styles.titleText}>{title}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
)}
|
|
40
|
+
<View
|
|
41
|
+
style={{
|
|
42
|
+
...styles.content,
|
|
43
|
+
...contentStyle,
|
|
44
|
+
}}>
|
|
45
|
+
{children}
|
|
46
|
+
</View>
|
|
47
|
+
{!customButton && (
|
|
48
|
+
<View style={styles.bottom}>
|
|
49
|
+
<Divider color="#EEE" />
|
|
50
|
+
<View style={styles.bottomBtnBox}>
|
|
51
|
+
<TouchableOpacity
|
|
52
|
+
style={styles.bottomBtn}
|
|
53
|
+
onPress={() => onVisibleChange(false)}>
|
|
54
|
+
<Text style={styles.bottomBtnText}>取消</Text>
|
|
55
|
+
</TouchableOpacity>
|
|
56
|
+
<Divider orientation="vertical" />
|
|
57
|
+
<TouchableOpacity
|
|
58
|
+
style={styles.bottomBtn}
|
|
59
|
+
onPress={handlerConfirm}>
|
|
60
|
+
<Text
|
|
61
|
+
style={{
|
|
62
|
+
...styles.bottomBtnText,
|
|
63
|
+
color: '#EA6000',
|
|
64
|
+
}}>
|
|
65
|
+
确定
|
|
66
|
+
</Text>
|
|
67
|
+
</TouchableOpacity>
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
)}
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
</TouchableOpacity>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const styles = StyleSheet.create({
|
|
77
|
+
mask: {
|
|
78
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
79
|
+
position: 'absolute',
|
|
80
|
+
top: 0,
|
|
81
|
+
bottom: 0,
|
|
82
|
+
left: 0,
|
|
83
|
+
right: 0,
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
},
|
|
87
|
+
container: {
|
|
88
|
+
backgroundColor: '#fff',
|
|
89
|
+
width: px(915),
|
|
90
|
+
borderRadius: px(44),
|
|
91
|
+
},
|
|
92
|
+
title: {
|
|
93
|
+
paddingTop: px(55),
|
|
94
|
+
paddingLeft: px(82),
|
|
95
|
+
},
|
|
96
|
+
titleText: {
|
|
97
|
+
...fontStyle(49, '#333', 'bold'),
|
|
98
|
+
},
|
|
99
|
+
content: {
|
|
100
|
+
paddingHorizontal: px(82),
|
|
101
|
+
paddingBottom: px(82),
|
|
102
|
+
paddingTop: px(66),
|
|
103
|
+
},
|
|
104
|
+
bottom: {},
|
|
105
|
+
bottomBtnBox: {
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
justifyContent: 'space-evenly',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
},
|
|
110
|
+
bottomBtn: {
|
|
111
|
+
flex: 1,
|
|
112
|
+
paddingVertical: px(36),
|
|
113
|
+
},
|
|
114
|
+
bottomBtnText: {
|
|
115
|
+
textAlign: 'center',
|
|
116
|
+
fontWeight: '500',
|
|
117
|
+
color: '#333',
|
|
118
|
+
fontSize: px(49),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
View,
|
|
3
|
+
Text,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Platform,
|
|
7
|
+
Image,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import {Icon} from '@rneui/themed';
|
|
11
|
+
|
|
12
|
+
import px from '../../../utils/scaleSize';
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
<ion-icon name="home"></ion-icon>
|
|
16
|
+
<ion-icon name="sunny"></ion-icon>
|
|
17
|
+
<ion-icon name="heart-half"></ion-icon>
|
|
18
|
+
<ion-icon name="cart"></ion-icon>
|
|
19
|
+
<ion-icon name="person"></ion-icon>
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export default ({state, descriptors, navigation}) => {
|
|
23
|
+
return (
|
|
24
|
+
<View style={styles.container}>
|
|
25
|
+
{state.routes.map((route, index) => {
|
|
26
|
+
// console.log(route, 'route');
|
|
27
|
+
const {options} = descriptors[route.key];
|
|
28
|
+
// console.log(options, 'descriptors');
|
|
29
|
+
let label;
|
|
30
|
+
if (options.moduleAlias !== undefined) {
|
|
31
|
+
label = options.moduleAlias;
|
|
32
|
+
} else if (options.tabBarLabel !== undefined) {
|
|
33
|
+
label = options.tabBarLabel;
|
|
34
|
+
} else if (options.title !== undefined) {
|
|
35
|
+
label = options.title;
|
|
36
|
+
} else {
|
|
37
|
+
label = route.name;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const isFocused = state.index === index;
|
|
41
|
+
|
|
42
|
+
const onPress = () => {
|
|
43
|
+
const event = navigation.emit({
|
|
44
|
+
type: 'tabPress',
|
|
45
|
+
target: route.key,
|
|
46
|
+
canPreventDefault: true,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (!isFocused && !event.defaultPrevented) {
|
|
50
|
+
// The `merge: true` option makes sure that the params inside the tab screen are preserved
|
|
51
|
+
navigation.navigate({name: route.name, merge: true});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onLongPress = () => {
|
|
56
|
+
navigation.emit({
|
|
57
|
+
type: 'tabLongPress',
|
|
58
|
+
target: route.key,
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const tabItemLabelFocusStyle = {
|
|
63
|
+
color: isFocused ? '#E86003' : '#999',
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const iconUri = isFocused ? options.activeIconUri : options.iconUri;
|
|
67
|
+
const icon = isFocused ? options.activeIcon : options.icon;
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<TouchableOpacity
|
|
71
|
+
key={index}
|
|
72
|
+
accessibilityRole="button"
|
|
73
|
+
accessibilityState={isFocused ? {selected: true} : {}}
|
|
74
|
+
accessibilityLabel={options.tabBarAccessibilityLabel}
|
|
75
|
+
testID={options.tabBarTestID}
|
|
76
|
+
activeOpacity={0.8}
|
|
77
|
+
onPress={onPress}
|
|
78
|
+
onLongPress={onLongPress}
|
|
79
|
+
style={styles.navItem}>
|
|
80
|
+
<View
|
|
81
|
+
style={{
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
height: 60,
|
|
85
|
+
}}>
|
|
86
|
+
{iconUri ? (
|
|
87
|
+
<Image
|
|
88
|
+
source={{uri: iconUri}}
|
|
89
|
+
style={{
|
|
90
|
+
width: px(69),
|
|
91
|
+
height: px(69),
|
|
92
|
+
}}
|
|
93
|
+
resizeMode="contain"
|
|
94
|
+
/>
|
|
95
|
+
) : (
|
|
96
|
+
icon && (
|
|
97
|
+
<Icon
|
|
98
|
+
name={icon}
|
|
99
|
+
type="ionicon"
|
|
100
|
+
size={px(69)}
|
|
101
|
+
color={tabItemLabelFocusStyle.color}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
)}
|
|
105
|
+
<Text style={[styles.tabItemLabel, tabItemLabelFocusStyle]}>
|
|
106
|
+
{label}
|
|
107
|
+
</Text>
|
|
108
|
+
</View>
|
|
109
|
+
</TouchableOpacity>
|
|
110
|
+
);
|
|
111
|
+
})}
|
|
112
|
+
</View>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const styles = StyleSheet.create({
|
|
117
|
+
container: {
|
|
118
|
+
flexDirection: 'row',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
height: 60,
|
|
121
|
+
backgroundColor: '#fff',
|
|
122
|
+
borderTopWidth: 1,
|
|
123
|
+
borderTopColor: '#f6f6f6',
|
|
124
|
+
|
|
125
|
+
// ...Platform.select({
|
|
126
|
+
// android: {
|
|
127
|
+
// shadowColor: '#290000',
|
|
128
|
+
// shadowOffset: {
|
|
129
|
+
// width: 0,
|
|
130
|
+
// height: 3,
|
|
131
|
+
// },
|
|
132
|
+
// shadowOpacity: 0.6,
|
|
133
|
+
// shadowRadius: 8,
|
|
134
|
+
// elevation: 20,
|
|
135
|
+
// },
|
|
136
|
+
// ios: {
|
|
137
|
+
// shadowColor: '#290000',
|
|
138
|
+
// shadowOffset: {
|
|
139
|
+
// width: 0,
|
|
140
|
+
// height: 1,
|
|
141
|
+
// },
|
|
142
|
+
// shadowOpacity: 0.1,
|
|
143
|
+
// shadowRadius: 2,
|
|
144
|
+
// elevation: 10,
|
|
145
|
+
// },
|
|
146
|
+
// }),
|
|
147
|
+
},
|
|
148
|
+
navItem: {
|
|
149
|
+
flex: 1,
|
|
150
|
+
},
|
|
151
|
+
tabItemLabel: {
|
|
152
|
+
textAlign: 'center',
|
|
153
|
+
fontSize: px(32),
|
|
154
|
+
marginTop: px(20),
|
|
155
|
+
fontWeight: '500',
|
|
156
|
+
},
|
|
157
|
+
});
|