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,232 @@
1
+ import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ FlatList,
8
+ Dimensions,
9
+ } from 'react-native';
10
+ import ActionSheet, {SheetManager} from 'react-native-actions-sheet';
11
+ import {Divider} from '@rneui/themed';
12
+ import px from '../../../utils/scaleSize';
13
+
14
+ const Index = ({sheetId, payload}) => {
15
+ const {columns = [], nameProp, defaultIndex = 0, disabled} = payload;
16
+
17
+ const [activeIndex, setActiveIndex] = useState(defaultIndex + 2);
18
+ const flatListRef = useRef(null);
19
+
20
+ // 渲染的列表 前后各加2个假的数据
21
+ const renderColumns = ['', ''].concat(columns).concat(['', '', '']);
22
+ const handleCancel = () => {
23
+ SheetManager.hide(sheetId);
24
+ };
25
+
26
+ const handleConfirm = () => {
27
+ // 保存时,index-2,因为前面加了两条假数据
28
+ SheetManager.hide(sheetId, {
29
+ payload: {
30
+ index: activeIndex - 2,
31
+ data: columns[activeIndex - 2],
32
+ },
33
+ });
34
+ };
35
+
36
+ const renderItem = ({item, index}) => {
37
+ const columnTextStyle =
38
+ index === activeIndex ? styles.activeColumnText : styles.columnText;
39
+ let columnDisabled = false;
40
+ if (typeof disabled === 'function') {
41
+ columnDisabled = disabled(item, index - 2);
42
+ }
43
+ return (
44
+ <TouchableOpacity
45
+ disabled={!item}
46
+ onPress={() =>
47
+ flatListRef.current?.scrollToIndex({
48
+ index: index - 2,
49
+ })
50
+ }
51
+ style={{
52
+ ...styles.column,
53
+ // borderTopWidth: index === activeIndex ? 1 : 0,
54
+ // borderBottomWidth: index === activeIndex ? 1 : 0,
55
+ // borderColor: '#eee',
56
+ }}>
57
+ <Text
58
+ style={{
59
+ ...columnTextStyle,
60
+ color: columnDisabled ? '#999' : columnTextStyle.color,
61
+ textDecorationLine: columnDisabled ? 'line-through' : 'none',
62
+ }}>
63
+ {nameProp ? item[nameProp] : item}
64
+ </Text>
65
+ </TouchableOpacity>
66
+ );
67
+ };
68
+
69
+ // 打开时定位到默认行
70
+ const onOpen = () => {
71
+ flatListRef.current?.scrollToIndex({
72
+ index: defaultIndex,
73
+ });
74
+ };
75
+
76
+ // 固定5个数据高度,永远聚焦中间那条 ios可以滚动出视图范围弹性地拉动一截,可能可视区域数量不一定是5个
77
+ const onViewableItemsChanged = useCallback(({viewableItems}) => {
78
+ if (
79
+ viewableItems.length >= 3 &&
80
+ viewableItems[viewableItems.length - 3].item
81
+ ) {
82
+ const index = viewableItems[viewableItems.length - 3].index;
83
+ setActiveIndex(index);
84
+ }
85
+ }, []);
86
+
87
+ return (
88
+ <>
89
+ <ActionSheet id={sheetId} isModal={true} onOpen={onOpen}>
90
+ {/*
91
+ <View style={styles.bufferColumns}>
92
+ {topColumns.map((item, index) => (
93
+ <View key={index} style={styles.column}>
94
+ <Text style={styles.columnText}>
95
+ {nameProp ? item[nameProp] : item}
96
+ </Text>
97
+ </View>
98
+ ))}
99
+ </View>
100
+ */}
101
+ <View style={styles.columns}>
102
+ <FlatList
103
+ scrollEnabled={true}
104
+ // ref={flatListRef}
105
+ ref={flatListRef}
106
+ showsVerticalScrollIndicator={false}
107
+ horizontal={false}
108
+ // alwaysBounceVertical={false}
109
+ // bounces={false}
110
+ pagingEnabled={false}
111
+ // overScrollMode="never"
112
+ numColumns={1}
113
+ data={renderColumns}
114
+ keyExtractor={(item, index) => index}
115
+ renderItem={renderItem}
116
+ getItemLayout={(data, index) => {
117
+ return {
118
+ length: px(150),
119
+ offset: px(150) * index,
120
+ index,
121
+ };
122
+ }}
123
+ onViewableItemsChanged={onViewableItemsChanged}
124
+ viewabilityConfig={{
125
+ viewAreaCoveragePercentThreshold: 50,
126
+ }}
127
+ />
128
+ </View>
129
+ {/*
130
+ <View style={styles.bufferColumns}>
131
+ {bottomColumns.map((item, index) => (
132
+ <View key={index} style={styles.column}>
133
+ <Text style={styles.columnText}>
134
+ {nameProp ? item[nameProp] : item}
135
+ </Text>
136
+ </View>
137
+ ))}
138
+ </View>
139
+ */}
140
+ <Divider color="#eee" width={1} />
141
+ <View style={styles.bottomBtnBox}>
142
+ <TouchableOpacity style={styles.bottomBtn} onPress={handleCancel}>
143
+ <Text style={styles.bottomBtnText}>取消</Text>
144
+ </TouchableOpacity>
145
+
146
+ <Divider orientation="vertical" width={1} color="#eee" />
147
+ <TouchableOpacity
148
+ disabled={
149
+ typeof disabled === 'function' &&
150
+ disabled(columns[activeIndex - 2], activeIndex - 2)
151
+ }
152
+ style={{
153
+ ...styles.bottomBtn,
154
+ opacity:
155
+ typeof disabled === 'function' &&
156
+ disabled(columns[activeIndex - 2], activeIndex - 2)
157
+ ? 0.3
158
+ : 1,
159
+ }}
160
+ onPress={handleConfirm}>
161
+ <Text
162
+ style={[
163
+ styles.bottomBtnText,
164
+ {
165
+ color: '#ea6000',
166
+ fontWeight: 'bold',
167
+ },
168
+ ]}>
169
+ 确定
170
+ </Text>
171
+ </TouchableOpacity>
172
+ </View>
173
+ </ActionSheet>
174
+ </>
175
+ );
176
+ };
177
+
178
+ const styles = StyleSheet.create({
179
+ bottomBtnBox: {
180
+ display: 'flex',
181
+ flexDirection: 'row',
182
+ justifyContent: 'space-evenly',
183
+ alignItems: 'center',
184
+ paddingTop: px(29),
185
+ paddingBottom: px(132),
186
+ },
187
+ bottomBtn: {
188
+ flex: 1,
189
+ },
190
+ bottomBtnText: {
191
+ textAlign: 'center',
192
+ color: '#666',
193
+ fontSize: px(52),
194
+ fontWeight: '500',
195
+ },
196
+ columns: {
197
+ paddingHorizontal: px(55),
198
+ // maxHeight: Math.floor(deviceHeight / 2),
199
+ height: px(150) * 5,
200
+ },
201
+ column: {
202
+ // paddingVertical: px(44),
203
+ height: px(150),
204
+ flexDirection: 'row',
205
+ alignItems: 'center',
206
+ justifyContent: 'center',
207
+ },
208
+ columnText: {
209
+ fontSize: px(40),
210
+ color: '#999',
211
+ textAlign: 'center',
212
+ fontWeight: '500',
213
+ },
214
+ activeColumnText: {
215
+ fontSize: px(69),
216
+ color: '#333',
217
+ textAlign: 'center',
218
+ fontWeight: '500',
219
+ },
220
+ select: {
221
+ width: px(47),
222
+ height: px(42),
223
+ },
224
+
225
+ // 缓冲列表
226
+ bufferColumns: {
227
+ paddingHorizontal: px(55),
228
+ height: px(300),
229
+ },
230
+ });
231
+
232
+ export default Index;
@@ -0,0 +1,171 @@
1
+ import React, {useEffect, useRef, useState} from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ Image,
8
+ FlatList,
9
+ Dimensions,
10
+ } from 'react-native';
11
+ import ActionSheet, {SheetManager} from 'react-native-actions-sheet';
12
+ import {Icon, CheckBox, Divider} from '@rneui/themed';
13
+ import px from '../../../utils/scaleSize';
14
+ const deviceHeight = Dimensions.get('window').height;
15
+
16
+ const Index = ({sheetId, payload}) => {
17
+ const {
18
+ columns = [],
19
+ nameProp,
20
+ defaultIndex = 0,
21
+ multiple = false,
22
+ defaultIndexs = [0],
23
+ } = payload;
24
+
25
+ const [activeIndex, setActiveIndex] = useState(defaultIndex);
26
+ // 用于多选时(multiple = true) 记录选择数据
27
+ const [selectIndexs, setSelectIndexs] = useState(defaultIndexs);
28
+ const flatListRef = useRef(null);
29
+
30
+ const handleCancel = () => {
31
+ SheetManager.hide(sheetId);
32
+ };
33
+
34
+ useEffect(() => {
35
+ if (!multiple) {
36
+ Promise.resolve().then(() => {
37
+ console.log(flatListRef.current);
38
+ flatListRef.current?.scrollToOffset({
39
+ offset: px(150) * defaultIndex,
40
+ });
41
+ });
42
+ }
43
+ }, []);
44
+
45
+ const handleConfirm = () => {
46
+ let payload;
47
+ if (multiple) {
48
+ payload = {
49
+ indexs: selectIndexs,
50
+ datas: selectIndexs.map(i => columns[i]),
51
+ };
52
+ } else {
53
+ payload = {
54
+ index: activeIndex,
55
+ data: columns[activeIndex],
56
+ };
57
+ }
58
+ SheetManager.hide(sheetId, {
59
+ payload,
60
+ });
61
+ };
62
+
63
+ const handleItemPress = index => {
64
+ if (multiple) {
65
+ let indexs = [...selectIndexs];
66
+ if (indexs.includes(index)) {
67
+ const deleteIndex = indexs.findIndex(item => item === index);
68
+ indexs.splice(deleteIndex, 1);
69
+ } else {
70
+ indexs.push(index);
71
+ indexs.sort((a, b) => a - b);
72
+ }
73
+ setSelectIndexs([...indexs]);
74
+ } else {
75
+ setActiveIndex(index);
76
+ }
77
+ };
78
+
79
+ const renderItem = ({item, index}) => {
80
+ const showConfirm =
81
+ (multiple && selectIndexs.includes(index)) ||
82
+ (!multiple && activeIndex === index);
83
+ return (
84
+ <TouchableOpacity
85
+ style={styles.column}
86
+ onPress={() => handleItemPress(index)}>
87
+ <Text style={styles.columnText}>
88
+ {nameProp ? item[nameProp] : item}
89
+ </Text>
90
+ {showConfirm && (
91
+ <Image
92
+ source={require('../../../assets/img/confirm.png')}
93
+ style={styles.select}
94
+ />
95
+ )}
96
+ </TouchableOpacity>
97
+ );
98
+ };
99
+
100
+ const onOpen = () => {
101
+ flatListRef.current?.scrollToOffset({
102
+ offset: px(150) * defaultIndex,
103
+ });
104
+ };
105
+
106
+ return (
107
+ <>
108
+ <ActionSheet id={sheetId} isModal={false} onOpen={onOpen}>
109
+ <View style={styles.columns}>
110
+ <FlatList
111
+ // ref={flatListRef}
112
+ ref={flatListRef}
113
+ showsVerticalScrollIndicator={false}
114
+ horizontal={false}
115
+ numColumns={1}
116
+ data={columns}
117
+ keyExtractor={(item, index) => index}
118
+ renderItem={renderItem}
119
+ />
120
+ </View>
121
+ <View style={styles.bottomBtnBox}>
122
+ <TouchableOpacity style={styles.bottomBtn} onPress={handleCancel}>
123
+ <Text style={styles.bottomBtnText}>取消</Text>
124
+ </TouchableOpacity>
125
+
126
+ <Divider orientation="vertical" />
127
+ <TouchableOpacity style={styles.bottomBtn} onPress={handleConfirm}>
128
+ <Text style={[styles.bottomBtnText]}>确定</Text>
129
+ </TouchableOpacity>
130
+ </View>
131
+ </ActionSheet>
132
+ </>
133
+ );
134
+ };
135
+
136
+ const styles = StyleSheet.create({
137
+ bottomBtnBox: {
138
+ display: 'flex',
139
+ flexDirection: 'row',
140
+ justifyContent: 'space-evenly',
141
+ alignItems: 'center',
142
+ paddingVertical: px(50),
143
+ },
144
+ bottomBtn: {
145
+ flex: 1,
146
+ },
147
+ bottomBtnText: {
148
+ textAlign: 'center',
149
+ },
150
+ columns: {
151
+ paddingHorizontal: px(55),
152
+ maxHeight: Math.floor(deviceHeight / 2),
153
+ },
154
+ column: {
155
+ // paddingVertical: px(44),
156
+ height: px(150),
157
+ flexDirection: 'row',
158
+ alignItems: 'center',
159
+ justifyContent: 'space-between',
160
+ },
161
+ columnText: {
162
+ fontSize: px(49),
163
+ color: '#333',
164
+ },
165
+ select: {
166
+ width: px(47),
167
+ height: px(42),
168
+ },
169
+ });
170
+
171
+ export default Index;
@@ -0,0 +1,93 @@
1
+ import React, {useState} from 'react';
2
+ import {
3
+ View,
4
+ TextInput,
5
+ Text,
6
+ Button,
7
+ StyleSheet,
8
+ TouchableOpacity,
9
+ } from 'react-native';
10
+
11
+ const Index = ({
12
+ value,
13
+ placeholder,
14
+ rightBtnDisabled,
15
+ rightBtnText,
16
+ onChangeText,
17
+ onRightBtnPress,
18
+ }) => {
19
+ const verifyBtnDisableStyle = {};
20
+ const verifyBtnTextDisableStyle = {};
21
+
22
+ if (rightBtnDisabled) {
23
+ verifyBtnDisableStyle.borderColor = 'rgba(217, 217, 217, 1)';
24
+ verifyBtnTextDisableStyle.color = 'rgba(217, 217, 217, 1)';
25
+ }
26
+
27
+ const handleGetVerifyCode = () => {
28
+ if (rightBtnDisabled) {
29
+ return;
30
+ }
31
+ onRightBtnPress();
32
+ };
33
+
34
+ return (
35
+ <View style={styles.container}>
36
+ <View style={styles.inputBox}>
37
+ <TextInput
38
+ style={styles.input}
39
+ value={value}
40
+ placeholder={placeholder}
41
+ onChangeText={onChangeText}
42
+ />
43
+ </View>
44
+ <View style={styles.btn}>
45
+ {/* <Button
46
+ title={rightBtnText}
47
+ disabled={rightBtnDisabled}
48
+ onPress={onRightBtnPress}
49
+ /> */}
50
+ <TouchableOpacity
51
+ activeOpacity={rightBtnDisabled ? 1 : 0.6}
52
+ onPress={handleGetVerifyCode}>
53
+ <View style={[styles.verifyBtn, verifyBtnDisableStyle]}>
54
+ <Text style={[styles.verifyBtnText, verifyBtnTextDisableStyle]}>
55
+ {rightBtnText}
56
+ </Text>
57
+ </View>
58
+ </TouchableOpacity>
59
+ </View>
60
+ </View>
61
+ );
62
+ };
63
+
64
+ const styles = StyleSheet.create({
65
+ container: {
66
+ flexDirection: 'row',
67
+ },
68
+ inputBox: {
69
+ flex: 1,
70
+ },
71
+ input: {
72
+ height: 50,
73
+ color: '#333',
74
+ },
75
+ btn: {
76
+ alignItems: 'center',
77
+ justifyContent: 'center',
78
+ },
79
+ verifyBtn: {
80
+ borderWidth: 1,
81
+ height: 30,
82
+ borderRadius: 15,
83
+ borderColor: 'rgba(234, 96, 0, 1)',
84
+ alignItems: 'center',
85
+ justifyContent: 'center',
86
+ paddingHorizontal: 10,
87
+ },
88
+ verifyBtnText: {
89
+ color: 'rgba(234, 96, 0, 1)',
90
+ },
91
+ });
92
+
93
+ export default Index;
@@ -0,0 +1,101 @@
1
+ import React, {useState} from 'react';
2
+ import {
3
+ View,
4
+ TextInput,
5
+ Text,
6
+ Button,
7
+ StyleSheet,
8
+ TouchableOpacity,
9
+ } from 'react-native';
10
+ import px from '../../../utils/scaleSize';
11
+ const Index = ({
12
+ value,
13
+ placeholder,
14
+ rightBtnDisabled,
15
+ rightBtnText,
16
+ onChangeText,
17
+ onRightBtnPress,
18
+ }) => {
19
+ const verifyBtnDisableStyle = {};
20
+ const verifyBtnTextDisableStyle = {};
21
+
22
+ if (rightBtnDisabled) {
23
+ verifyBtnDisableStyle.borderColor = 'rgba(217, 217, 217, 1)';
24
+ verifyBtnTextDisableStyle.color = 'rgba(217, 217, 217, 1)';
25
+ }
26
+
27
+ const handleGetVerifyCode = () => {
28
+ if (rightBtnDisabled) {
29
+ return;
30
+ }
31
+ onRightBtnPress();
32
+ };
33
+
34
+ return (
35
+ <View style={styles.container}>
36
+ <View style={styles.inputBox}>
37
+ <TextInput
38
+ keyboardType="number-pad"
39
+ style={styles.input}
40
+ value={value}
41
+ placeholder={placeholder}
42
+ placeholderTextColor="#A6A6A6"
43
+ onChangeText={onChangeText}
44
+ returnKeyType="done"
45
+ />
46
+ </View>
47
+ <View style={styles.btn}>
48
+ {/* <Button
49
+ title={rightBtnText}
50
+ disabled={rightBtnDisabled}
51
+ onPress={onRightBtnPress}
52
+ /> */}
53
+ <TouchableOpacity
54
+ activeOpacity={rightBtnDisabled ? 1 : 0.6}
55
+ onPress={handleGetVerifyCode}>
56
+ <View
57
+ style={[
58
+ styles.verifyBtn,
59
+ verifyBtnDisableStyle,
60
+ {borderColor: '#fff'},
61
+ ]}>
62
+ <Text style={[styles.verifyBtnText, verifyBtnTextDisableStyle]}>
63
+ {rightBtnText}
64
+ </Text>
65
+ </View>
66
+ </TouchableOpacity>
67
+ </View>
68
+ </View>
69
+ );
70
+ };
71
+
72
+ const styles = StyleSheet.create({
73
+ container: {
74
+ flexDirection: 'row',
75
+ },
76
+ inputBox: {
77
+ flex: 1,
78
+ },
79
+ input: {
80
+ height: 50,
81
+ color: '#333',
82
+ },
83
+ btn: {
84
+ alignItems: 'center',
85
+ justifyContent: 'center',
86
+ },
87
+ verifyBtn: {
88
+ borderWidth: 1,
89
+ height: 30,
90
+ borderRadius: 15,
91
+ alignItems: 'center',
92
+ justifyContent: 'center',
93
+ paddingHorizontal: 10,
94
+ },
95
+ verifyBtnText: {
96
+ color: '#E86003',
97
+ fontSize: px(35),
98
+ },
99
+ });
100
+
101
+ export default Index;
@@ -0,0 +1,126 @@
1
+ import React from 'react';
2
+ import {Text, StyleSheet, View} from 'react-native';
3
+ import {Icon} from '@rneui/themed';
4
+
5
+ const Index = ({steps, active}) => {
6
+ const getLastDot = index => {
7
+ if (index === active) {
8
+ return (
9
+ <Icon name="checkmark-circle" type="ionicon" size={10} color="#0f0" />
10
+ );
11
+ } else if (index < active) {
12
+ return <View style={[styles.dot]} />;
13
+ } else {
14
+ return (
15
+ <View
16
+ style={[
17
+ styles.dot,
18
+ {
19
+ backgroundColor: '#ccc',
20
+ },
21
+ ]}
22
+ />
23
+ );
24
+ }
25
+ };
26
+
27
+ const getLineStyle = index => {
28
+ if (index + 1 <= active) {
29
+ return {
30
+ backgroundColor: '#0f0',
31
+ };
32
+ } else {
33
+ return {
34
+ backgroundColor: '#ccc',
35
+ };
36
+ }
37
+ };
38
+
39
+ return (
40
+ <View>
41
+ <View
42
+ style={[
43
+ styles.list,
44
+ {
45
+ height: 20,
46
+ justifyContent: 'space-between',
47
+ },
48
+ ]}>
49
+ {steps.map((item, index) => {
50
+ return (
51
+ <Text
52
+ key={index}
53
+ style={{
54
+ color: index === active ? '#0f0' : '#000',
55
+ }}>
56
+ {item.text}
57
+ </Text>
58
+ );
59
+ })}
60
+ </View>
61
+
62
+ <View
63
+ style={[
64
+ styles.list,
65
+ {
66
+ height: 30,
67
+ },
68
+ ]}>
69
+ {new Array(steps.length - 1).fill().map((item, index) => {
70
+ return (
71
+ <View style={[styles.item]} key={index}>
72
+ {<View style={styles.dotContainer}>{getLastDot(index)}</View>}
73
+ <View
74
+ style={[
75
+ styles.line,
76
+ getLineStyle(index),
77
+ {
78
+ marginRight: index === steps.length - 2 ? 10 : 0,
79
+ },
80
+ ]}
81
+ />
82
+ {index === steps.length - 2 ? (
83
+ <View style={styles.dotContainer}>{getLastDot(index + 1)}</View>
84
+ ) : (
85
+ <View />
86
+ )}
87
+ </View>
88
+ );
89
+ })}
90
+ </View>
91
+ </View>
92
+ );
93
+ };
94
+
95
+ const styles = StyleSheet.create({
96
+ list: {
97
+ flexDirection: 'row',
98
+ paddingLeft: 10,
99
+ paddingRight: 10,
100
+ },
101
+ item: {
102
+ flex: 1,
103
+ alignItems: 'center',
104
+ marginRight: 10,
105
+ flexDirection: 'row',
106
+ },
107
+ dotContainer: {
108
+ width: 10,
109
+ height: 10,
110
+ alignItems: 'center',
111
+ justifyContent: 'center',
112
+ },
113
+ dot: {
114
+ width: 5,
115
+ height: 5,
116
+ borderRadius: 2.5,
117
+ backgroundColor: '#0f0',
118
+ },
119
+ line: {
120
+ flex: 1,
121
+ height: 1,
122
+ marginLeft: 10,
123
+ },
124
+ });
125
+
126
+ export default Index;