@aks-dev/easyui 1.0.163 → 1.1.5

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 (176) hide show
  1. package/dist/components/AnimationModal/AnimationModal.d.ts +27 -0
  2. package/dist/components/AnimationModal/AnimationModal.d.ts.map +1 -0
  3. package/dist/components/AnimationModal/AnimationModal.js +151 -0
  4. package/dist/components/Badge/Badge.d.ts +8 -0
  5. package/dist/components/Badge/Badge.d.ts.map +1 -0
  6. package/dist/components/Badge/Badge.js +35 -0
  7. package/dist/components/DottedLine/DottedLine.d.ts +10 -0
  8. package/dist/components/DottedLine/DottedLine.d.ts.map +1 -0
  9. package/dist/components/DottedLine/DottedLine.js +50 -0
  10. package/dist/components/EchartsView/EchartsView.d.ts +10 -0
  11. package/dist/components/EchartsView/EchartsView.d.ts.map +1 -0
  12. package/{lib/Echarts/EchartsView.tsx → dist/components/EchartsView/EchartsView.js} +74 -113
  13. package/dist/components/EchartsView/helper.d.ts +10 -0
  14. package/dist/components/EchartsView/helper.d.ts.map +1 -0
  15. package/{lib/Echarts/helper.tsx → dist/components/EchartsView/helper.js} +17 -24
  16. package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts +25 -0
  17. package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -0
  18. package/dist/components/Hud/AlertBottomView/AlertBottomView.js +174 -0
  19. package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts +19 -0
  20. package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -0
  21. package/dist/components/Hud/AlertSheetView/AlertSheetView.js +117 -0
  22. package/dist/components/Hud/AlertView/AlertView.d.ts +25 -0
  23. package/dist/components/Hud/AlertView/AlertView.d.ts.map +1 -0
  24. package/dist/components/Hud/AlertView/AlertView.js +184 -0
  25. package/dist/components/Hud/Hud.d.ts +11 -0
  26. package/dist/components/Hud/Hud.d.ts.map +1 -0
  27. package/dist/components/Hud/Hud.js +29 -0
  28. package/dist/components/Hud/Loading/Loading.d.ts +11 -0
  29. package/dist/components/Hud/Loading/Loading.d.ts.map +1 -0
  30. package/dist/components/Hud/Loading/Loading.js +66 -0
  31. package/dist/components/Hud/PopoverView/PopoverView.d.ts +17 -0
  32. package/dist/components/Hud/PopoverView/PopoverView.d.ts.map +1 -0
  33. package/dist/components/Hud/PopoverView/PopoverView.js +47 -0
  34. package/dist/components/Hud/Scanner/Scanner.d.ts +12 -0
  35. package/dist/components/Hud/Scanner/Scanner.d.ts.map +1 -0
  36. package/dist/components/Hud/Scanner/Scanner.js +301 -0
  37. package/dist/components/Hud/Toast/Toast.d.ts +9 -0
  38. package/dist/components/Hud/Toast/Toast.d.ts.map +1 -0
  39. package/dist/components/Hud/Toast/Toast.js +71 -0
  40. package/dist/components/MenuView/MenuView.d.ts +21 -0
  41. package/dist/components/MenuView/MenuView.d.ts.map +1 -0
  42. package/dist/components/MenuView/MenuView.js +184 -0
  43. package/dist/components/Modal/Modal.d.ts +2 -0
  44. package/dist/components/Modal/Modal.d.ts.map +1 -0
  45. package/{lib/Modal/Modal.tsx → dist/components/Modal/Modal.js} +1 -4
  46. package/{lib/MutiPictureView/index.ts → dist/components/MutiPictureView/MutiPictureView.d.ts} +18 -31
  47. package/dist/components/MutiPictureView/MutiPictureView.d.ts.map +1 -0
  48. package/dist/components/MutiPictureView/MutiPictureView.js +243 -0
  49. package/dist/components/PictureViewer/PictureViewer.d.ts +17 -0
  50. package/dist/components/PictureViewer/PictureViewer.d.ts.map +1 -0
  51. package/dist/components/PictureViewer/PictureViewer.js +54 -0
  52. package/dist/components/RefreshList/RefreshList.d.ts +45 -0
  53. package/dist/components/RefreshList/RefreshList.d.ts.map +1 -0
  54. package/dist/components/RefreshList/RefreshList.js +155 -0
  55. package/dist/components/RichText/RichText.d.ts +12 -0
  56. package/dist/components/RichText/RichText.d.ts.map +1 -0
  57. package/dist/components/RichText/RichText.js +56 -0
  58. package/dist/components/StickHeaderView/StickHeaderView.d.ts +15 -0
  59. package/dist/components/StickHeaderView/StickHeaderView.d.ts.map +1 -0
  60. package/dist/components/StickHeaderView/StickHeaderView.js +37 -0
  61. package/{lib/TableCell/index.ts → dist/components/TableCell/TableCell.d.ts} +8 -30
  62. package/dist/components/TableCell/TableCell.d.ts.map +1 -0
  63. package/dist/components/TableCell/TableCell.js +97 -0
  64. package/dist/components/TextInputArea/TextInputArea.d.ts +17 -0
  65. package/dist/components/TextInputArea/TextInputArea.d.ts.map +1 -0
  66. package/dist/components/TextInputArea/TextInputArea.js +65 -0
  67. package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts +23 -0
  68. package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts.map +1 -0
  69. package/dist/components/WithLoadingContainer/WithLoadingContainer.js +77 -0
  70. package/dist/index.d.ts +23 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +32 -0
  73. package/dist/jsbridge/RNEasyui.d.ts +23 -0
  74. package/dist/jsbridge/RNEasyui.d.ts.map +1 -0
  75. package/dist/jsbridge/RNEasyui.js +46 -0
  76. package/dist/jsbridge/UpgradeModule.d.ts +26 -0
  77. package/dist/jsbridge/UpgradeModule.d.ts.map +1 -0
  78. package/{jsbridge/UpgradeModule.ts → dist/jsbridge/UpgradeModule.js} +25 -23
  79. package/dist/jsbridge/index.d.ts +3 -0
  80. package/dist/jsbridge/index.d.ts.map +1 -0
  81. package/{jsbridge/index.ts → dist/jsbridge/index.js} +2 -2
  82. package/dist/screen/index.d.ts +3 -0
  83. package/dist/screen/index.d.ts.map +1 -0
  84. package/{screen/index.ts → dist/screen/index.js} +2 -2
  85. package/{screen/index.d.ts → dist/screen/px2dp.d.ts} +6 -12
  86. package/dist/screen/px2dp.d.ts.map +1 -0
  87. package/dist/screen/px2dp.js +45 -0
  88. package/dist/screen/px2sp.d.ts +2 -0
  89. package/dist/screen/px2sp.d.ts.map +1 -0
  90. package/{screen/px2sp.ts → dist/screen/px2sp.js} +13 -20
  91. package/dist/screen/text-fit.d.ts +5 -0
  92. package/dist/screen/text-fit.d.ts.map +1 -0
  93. package/{screen/text-fit.ts → dist/screen/text-fit.js} +10 -20
  94. package/dist/utils/index.d.ts +3 -0
  95. package/dist/utils/index.d.ts.map +1 -0
  96. package/{utils/index.ts → dist/utils/index.js} +2 -2
  97. package/{utils/index.d.ts → dist/utils/lazy.d.ts} +15 -53
  98. package/dist/utils/lazy.d.ts.map +1 -0
  99. package/{utils/lazy.ts → dist/utils/lazy.js} +164 -165
  100. package/dist/utils/mode.d.ts +24 -0
  101. package/dist/utils/mode.d.ts.map +1 -0
  102. package/dist/utils/mode.js +50 -0
  103. package/package.json +32 -22
  104. package/readme.md +3 -3
  105. package/android/.DS_Store +0 -0
  106. package/android/src/.DS_Store +0 -0
  107. package/android/src/main/.DS_Store +0 -0
  108. package/android/src/main/java/.DS_Store +0 -0
  109. package/android/src/main/java/com/.DS_Store +0 -0
  110. package/android/src/main/java/com/easyui/.DS_Store +0 -0
  111. package/i.sh +0 -23
  112. package/ios/.DS_Store +0 -0
  113. package/ios/assets/.DS_Store +0 -0
  114. package/ios/views/.DS_Store +0 -0
  115. package/jsbridge/RNEasyui.ts +0 -42
  116. package/jsbridge/index.d.ts +0 -67
  117. package/lib/.DS_Store +0 -0
  118. package/lib/AnimationModal/AnimationModal.tsx +0 -201
  119. package/lib/AnimationModal/index.d.ts +0 -41
  120. package/lib/Badge/Badge.tsx +0 -40
  121. package/lib/Badge/index.ts +0 -21
  122. package/lib/DottedLine/DottedLine.tsx +0 -66
  123. package/lib/DottedLine/index.ts +0 -18
  124. package/lib/Echarts/demo.tsx +0 -235
  125. package/lib/Echarts/index.ts +0 -29
  126. package/lib/Hud/.DS_Store +0 -0
  127. package/lib/Hud/AlertBottomView/AlertBottomView.tsx +0 -228
  128. package/lib/Hud/AlertBottomView/index.d.ts +0 -42
  129. package/lib/Hud/AlertSheetView/AlertSheetView.tsx +0 -179
  130. package/lib/Hud/AlertSheetView/index.d.ts +0 -35
  131. package/lib/Hud/AlertView/AlertView.tsx +0 -234
  132. package/lib/Hud/AlertView/index.d.ts +0 -46
  133. package/lib/Hud/Hud.tsx +0 -67
  134. package/lib/Hud/Loading/Loading.tsx +0 -87
  135. package/lib/Hud/Loading/index.d.ts +0 -38
  136. package/lib/Hud/PopoverView/PopoverView.tsx +0 -66
  137. package/lib/Hud/PopoverView/index.d.ts +0 -39
  138. package/lib/Hud/Scanner/Scanner.tsx +0 -250
  139. package/lib/Hud/Scanner/index.d.ts +0 -42
  140. package/lib/Hud/Toast/Toast.tsx +0 -86
  141. package/lib/Hud/Toast/index.d.ts +0 -22
  142. package/lib/Hud/index.ts +0 -20
  143. package/lib/MenuView/MenuView.tsx +0 -252
  144. package/lib/MenuView/index.ts +0 -31
  145. package/lib/Modal/index.ts +0 -10
  146. package/lib/MutiPictureView/MutiPictureView.tsx +0 -259
  147. package/lib/PictureViewer/PictureViewer.tsx +0 -80
  148. package/lib/PictureViewer/index.ts +0 -26
  149. package/lib/RefreshList/RefreshList.tsx +0 -235
  150. package/lib/RefreshList/demo.tsx +0 -30
  151. package/lib/RefreshList/demo1.tsx +0 -60
  152. package/lib/RefreshList/demo2.tsx +0 -46
  153. package/lib/RefreshList/index.ts +0 -84
  154. package/lib/RichText/RichText.tsx +0 -82
  155. package/lib/RichText/index.ts +0 -21
  156. package/lib/StickHeaderView/StickHeaderView.tsx +0 -65
  157. package/lib/StickHeaderView/demo.tsx +0 -104
  158. package/lib/StickHeaderView/index.ts +0 -26
  159. package/lib/TableCell/TableCell.tsx +0 -118
  160. package/lib/TextInputArea/TextInputArea.tsx +0 -89
  161. package/lib/TextInputArea/index.d.ts +0 -33
  162. package/lib/WithLoadingContainer/WithLoadingContainer.tsx +0 -93
  163. package/lib/WithLoadingContainer/index.ts +0 -36
  164. package/screen/px2dp.ts +0 -51
  165. package/src/index.d.ts +0 -42
  166. package/src/index.ts +0 -54
  167. package/utils/mode.ts +0 -48
  168. /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-blue.png +0 -0
  169. /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-white.png +0 -0
  170. /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/icon_back_white.png +0 -0
  171. /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_add_image.png +0 -0
  172. /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_del_image.png +0 -0
  173. /package/{lib/TableCell → dist/components/TableCell/assets}/back.png +0 -0
  174. /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading.gif +0 -0
  175. /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading3.gif +0 -0
  176. /package/{lib → dist/components}/index.md +0 -0
@@ -1,235 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-05-06 12:05:42
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-06 12:07:58
6
- * @FilePath: /@aks/easyui/lib/Echarts/demo.tsx
7
- */
8
-
9
-
10
-
11
- import * as React from 'react'
12
- import { View, StyleSheet, } from 'react-native';
13
-
14
- import EchartsView from './EchartsView'
15
- import {echarts} from '.'
16
-
17
-
18
-
19
- export default () => {
20
-
21
-
22
-
23
- let option = {
24
- color: ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'],
25
- title: {
26
- text: 'Gradient Stacked Area Chart'
27
- },
28
- tooltip: {
29
- trigger: 'axis',
30
- axisPointer: {
31
- type: 'cross',
32
- label: {
33
- backgroundColor: '#6a7985'
34
- }
35
- }
36
- },
37
- legend: {
38
- data: ['Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5']
39
- },
40
- toolbox: {
41
- feature: {
42
- saveAsImage: {}
43
- }
44
- },
45
- grid: {
46
- left: '3%',
47
- right: '4%',
48
- bottom: '3%',
49
- containLabel: true
50
- },
51
- xAxis: [
52
- {
53
- type: 'category',
54
- boundaryGap: false,
55
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
56
- }
57
- ],
58
- yAxis: [
59
- {
60
- type: 'value'
61
- }
62
- ],
63
- series: [
64
- {
65
- name: 'Line 1',
66
- type: 'line',
67
- stack: 'Total',
68
- smooth: true,
69
- lineStyle: {
70
- width: 0
71
- },
72
- showSymbol: false,
73
- areaStyle: {
74
- opacity: 0.8,
75
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
76
- {
77
- offset: 0,
78
- color: 'rgb(128, 255, 165)'
79
- },
80
- {
81
- offset: 1,
82
- color: 'rgb(1, 191, 236)'
83
- }
84
- ])
85
- },
86
- emphasis: {
87
- focus: 'series'
88
- },
89
- data: [140, 232, 101, 264, 90, 340, 250]
90
- },
91
- {
92
- name: 'Line 2',
93
- type: 'line',
94
- stack: 'Total',
95
- smooth: true,
96
- lineStyle: {
97
- width: 0
98
- },
99
- showSymbol: false,
100
- areaStyle: {
101
- opacity: 0.8,
102
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
103
- {
104
- offset: 0,
105
- color: 'rgb(0, 221, 255)'
106
- },
107
- {
108
- offset: 1,
109
- color: 'rgb(77, 119, 255)'
110
- }
111
- ])
112
- },
113
- emphasis: {
114
- focus: 'series'
115
- },
116
- data: [120, 282, 111, 234, 220, 340, 310]
117
- },
118
- {
119
- name: 'Line 3',
120
- type: 'line',
121
- stack: 'Total',
122
- smooth: true,
123
- lineStyle: {
124
- width: 0
125
- },
126
- showSymbol: false,
127
- areaStyle: {
128
- opacity: 0.8,
129
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
130
- {
131
- offset: 0,
132
- color: 'rgb(55, 162, 255)'
133
- },
134
- {
135
- offset: 1,
136
- color: 'rgb(116, 21, 219)'
137
- }
138
- ])
139
- },
140
- emphasis: {
141
- focus: 'series'
142
- },
143
- data: [320, 132, 201, 334, 190, 130, 220]
144
- },
145
- {
146
- name: 'Line 4',
147
- type: 'line',
148
- stack: 'Total',
149
- smooth: true,
150
- lineStyle: {
151
- width: 0
152
- },
153
- showSymbol: false,
154
- areaStyle: {
155
- opacity: 0.8,
156
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
157
- {
158
- offset: 0,
159
- color: 'rgb(255, 0, 135)'
160
- },
161
- {
162
- offset: 1,
163
- color: 'rgb(135, 0, 157)'
164
- }
165
- ])
166
- },
167
- emphasis: {
168
- focus: 'series'
169
- },
170
- data: [220, 402, 231, 134, 190, 230, 120]
171
- },
172
- {
173
- name: 'Line 5',
174
- type: 'line',
175
- stack: 'Total',
176
- smooth: true,
177
- lineStyle: {
178
- width: 0
179
- },
180
- showSymbol: false,
181
- label: {
182
- show: true,
183
- position: 'top'
184
- },
185
- areaStyle: {
186
- opacity: 0.8,
187
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
188
- {
189
- offset: 0,
190
- color: 'rgb(255, 191, 0)'
191
- },
192
- {
193
- offset: 1,
194
- color: 'rgb(224, 62, 76)'
195
- }
196
- ])
197
- },
198
- emphasis: {
199
- focus: 'series'
200
- },
201
- data: [220, 302, 181, 234, 210, 290, 150]
202
- }
203
- ]
204
- };
205
-
206
-
207
-
208
-
209
-
210
- return (
211
- <View style={styles.container}>
212
-
213
- <View style={{ width: 100, height: 100, backgroundColor: 'pink' }} />
214
- <EchartsView
215
- option={option}
216
- style={{
217
- marginTop: 100,
218
- marginHorizontal: 20,
219
- height: 200,
220
- // backgroundColor: 'red'
221
- }}
222
- />
223
-
224
- </View>
225
- )
226
- }
227
-
228
-
229
- const styles = StyleSheet.create({
230
- container: {
231
- flexGrow: 1,
232
- display: 'flex',
233
- },
234
-
235
- })
@@ -1,29 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-05-05 14:52:22
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-06 10:10:43
6
- * @FilePath: /@aks/easyui/lib/Echarts/index.ts
7
- */
8
-
9
- import * as React from 'react'
10
- import { StyleProp, ViewStyle } from 'react-native'
11
-
12
- export type EchartsViewProps = {
13
- option: any;
14
- style?: StyleProp<ViewStyle>;
15
- renderLoading?: () => React.ReactElement;
16
- }
17
-
18
-
19
-
20
- export declare const EchartsView: React.FC<EchartsViewProps>;
21
-
22
-
23
-
24
- import * as echarts from 'echarts/core'
25
-
26
-
27
- export {
28
- echarts
29
- }
package/lib/Hud/.DS_Store DELETED
Binary file
@@ -1,228 +0,0 @@
1
- import * as React from 'react'
2
- import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity,Dimensions } from 'react-native'
3
- import Modal from 'react-native-modal'
4
-
5
- import { px2dp, deviceWidth } from '../../../screen/px2dp'
6
- import { px2sp } from '../../../screen/px2sp'
7
-
8
- import { AlertBottomOptions } from '.'
9
-
10
-
11
-
12
- type State = {
13
- visible: boolean;
14
-
15
- } & Omit<AlertBottomOptions, 'cancel' | 'confirm'>
16
-
17
-
18
-
19
-
20
-
21
- export default React.forwardRef<AlertBottomOptions.RefAttributes, {}>((_, ref) => {
22
-
23
-
24
- const defaultState: Partial<State> = {
25
- visible: false,
26
- cancelText: '取消',
27
- confirmText: '确定',
28
- }
29
- const [state, setState] = React.useState<Partial<State>>(defaultState)
30
- const cancelCallbackRef = React.useRef<Function>();
31
- const confirmCallbackRef = React.useRef<Function>();
32
-
33
-
34
-
35
- React.useImperativeHandle<unknown, AlertBottomOptions.RefAttributes>(ref, () => ({
36
- show: async (options: Partial<AlertBottomOptions>) => {
37
-
38
- setState(Object.assign({}, defaultState, { visible: true }, options))
39
- cancelCallbackRef.current = options.cancel;
40
- confirmCallbackRef.current = options.confirm;
41
-
42
- },
43
- hide
44
- }), [])
45
-
46
-
47
- const hide = async () => {
48
- setState(defaultState)
49
- }
50
-
51
-
52
- React.useEffect(() => {
53
- if (Platform.OS == 'android') {
54
- if (state.visible) {
55
- StatusBar.setBackgroundColor('black')
56
- StatusBar.setBarStyle('light-content')
57
- } else {
58
- StatusBar.setBackgroundColor('transparent')
59
- StatusBar.setBarStyle('dark-content')
60
- }
61
- }
62
-
63
- }, [state.visible])
64
- return (
65
- <Modal
66
- hideModalContentWhileAnimating={true}//通过隐藏模态内容直到动画完成来增强性能
67
- useNativeDriver={true}//定义动画是否应使用本机驱动程序
68
- animationIn='slideInUp'
69
- animationOut='slideOutDown'
70
- onBackButtonPress={() => {
71
- //按下Android后退按钮时调用
72
- hide()
73
- }}
74
- onBackdropPress={() => {
75
- //按下背景时调用
76
- hide()
77
- }}
78
- isVisible={state.visible}
79
- style={{ margin: 0 }}
80
- deviceHeight={Dimensions.get('screen').height}
81
- >
82
- <View style={styles.container}>
83
- <View style={[styles.wrapper, state.wrapperStyle]}>
84
- {state.title && <Text style={styles.titleText}>{state.title}</Text>}
85
- <View style={[state.contentContainerStyle]}>
86
- {(() => {
87
- if (typeof state.content == 'string') return <Text style={styles.contentText}>{state.content}</Text>
88
- if (React.isValidElement(state.content)) return state.content;
89
- return <View />
90
- })()}
91
- </View>
92
- {
93
- (state.cancelText || state.confirmText) &&
94
- <View style={styles.action}>
95
- {state.cancelText &&
96
- <TouchableOpacity
97
- style={[styles.cancel, { marginRight: state.confirmText ? px2dp(15) : 0 }, state.cancelContainerStyle]}
98
- activeOpacity={0.8}
99
- onPress={() => {
100
- hide()
101
- cancelCallbackRef.current && cancelCallbackRef.current()
102
- cancelCallbackRef.current = undefined;
103
-
104
- }}>
105
- <Text style={[styles.cancelText, state.cancelTextStyle]}>{state.cancelText}</Text>
106
- </TouchableOpacity>
107
- }
108
-
109
- {state.confirmText &&
110
- <TouchableOpacity
111
- style={[styles.confirm, { marginLeft: state.cancelText ? px2dp(15) : 0 }, state.confirmContainerStyle]}
112
- activeOpacity={0.8}
113
- onPress={() => {
114
- hide()
115
- confirmCallbackRef.current && confirmCallbackRef.current()
116
- confirmCallbackRef.current = undefined;
117
- }}>
118
- <Text style={[styles.confirmText, state.confirmTextStyle]}>{state.confirmText}</Text>
119
- </TouchableOpacity>
120
- }
121
- </View>
122
- }
123
-
124
- </View>
125
-
126
- </View>
127
- </Modal>
128
- )
129
- })
130
-
131
-
132
-
133
- export const alertBottomViewRef = React.createRef<AlertBottomOptions.RefAttributes>();
134
-
135
-
136
-
137
- export const showAlertBottomModal = (props: Partial<AlertBottomOptions>) => {
138
- alertBottomViewRef.current?.show(props)
139
- }
140
-
141
-
142
-
143
- // const sleep = (msec?: number) => {
144
- // return new Promise(resolve => {
145
- // setTimeout(resolve, msec || 350);
146
- // });
147
- // }
148
-
149
-
150
-
151
- const styles = StyleSheet.create({
152
- container: {
153
- display: 'flex',
154
- flexGrow: 1,
155
- justifyContent: 'flex-end',
156
- alignItems: 'center',
157
-
158
- },
159
-
160
- wrapper: {
161
- flexGrow: 0,
162
- flexShrink: 0,
163
- width: '100%',
164
- backgroundColor: 'white',
165
- overflow: 'hidden',
166
- borderTopLeftRadius: px2dp(10),
167
- borderTopRightRadius: px2dp(10),
168
- display: 'flex',
169
- padding: px2dp(15),
170
- },
171
- titleText: {
172
- maxWidth: deviceWidth - px2dp(30),
173
- fontSize: px2sp(18),
174
- marginBottom: px2dp(20),
175
- // backgroundColor: 'red',
176
- textAlign: 'center',
177
- fontWeight: 'bold',
178
- color: '#1A1A1A'
179
- },
180
- contentText: {
181
- maxWidth: deviceWidth - px2dp(30),
182
- marginBottom: px2dp(20),
183
- minHeight: px2dp(40),
184
- flexGrow: 0,
185
- flexShrink: 1,
186
- width: undefined,
187
- fontSize: px2sp(15),
188
- // backgroundColor: 'red',
189
- color: '#1A1A1A',
190
- textAlign: 'center'
191
- },
192
- action: {
193
- display: 'flex',
194
- flexDirection: 'row',
195
- justifyContent: 'space-between',
196
- alignItems: 'center',
197
- // backgroundColor:"red"
198
- },
199
- cancel: {
200
- width: '40%',
201
- height: px2dp(44),
202
- display: 'flex',
203
- justifyContent: 'center',
204
- alignItems: 'center',
205
- borderRadius: px2dp(10),
206
- borderWidth: px2dp(1),
207
- borderColor: '#A3A9CC'
208
- },
209
-
210
- confirm: {
211
- width: '40%',
212
- height: px2dp(44),
213
- display: 'flex',
214
- justifyContent: 'center',
215
- alignItems: 'center',
216
- backgroundColor: '#2763FF',
217
- borderRadius: px2dp(10)
218
- },
219
- cancelText: {
220
- fontSize: px2sp(15),
221
- color: '#A3A9CC',
222
-
223
- },
224
- confirmText: {
225
- fontSize: px2sp(15),
226
- color: 'white'
227
- },
228
- })
@@ -1,42 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-22 17:30:32
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-09-09 10:52:55
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/AlertBottomView/index.d.ts
7
- */
8
- import * as React from 'react'
9
-
10
-
11
- import { StyleProp, ViewStyle, TextStyle } from 'react-native'
12
-
13
-
14
- export declare type AlertBottomOptions = {
15
- title: string;
16
- wrapperStyle: StyleProp<ViewStyle>;
17
- content: string | React.ReactElement;
18
- contentContainerStyle:StyleProp<ViewStyle>;
19
- cancelText: string;
20
- cancelContainerStyle: StyleProp<ViewStyle>;
21
- cancelTextStyle: StyleProp<TextStyle>;
22
- cancel: () => void;
23
- confirmText: string;
24
- confirmContainerStyle: StyleProp<ViewStyle>;
25
- confirmTextStyle: StyleProp<TextStyle>;
26
- confirm: () => void;
27
- }
28
-
29
-
30
- export declare const showAlertBottomModal: (props: Partial<AlertBottomOptions>) => void;
31
-
32
- declare namespace AlertBottomOptions {
33
- type RefAttributes = {
34
- show: (options: Partial<AlertBottomOptions>) => void;
35
- hide: () => void;
36
- }
37
- }
38
-
39
-
40
- export declare const AlertBottomView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertBottomOptions.RefAttributes>>;
41
-
42
- export declare const AlertBottomViewRef: React.RefObject<AlertBottomOptions.RefAttributes>
@@ -1,179 +0,0 @@
1
- import * as React from 'react'
2
- import { Dimensions, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
3
- import Modal from 'react-native-modal'
4
- import { AlertSheetViewOptions } from '.'
5
- import { px2dp } from '../../../screen/px2dp'
6
- import { px2sp } from '../../../screen/px2sp'
7
-
8
-
9
-
10
-
11
-
12
- type State = {
13
- visible: boolean;
14
- } & AlertSheetViewOptions
15
-
16
-
17
-
18
-
19
-
20
- export default React.forwardRef<AlertSheetViewOptions.RefAttributes, {}>((_, ref) => {
21
-
22
-
23
- const defaultState: Partial<State> = {
24
- visible: false,
25
- actions: []
26
- }
27
- const [state, setState] = React.useState<Partial<State>>(defaultState)
28
-
29
- React.useImperativeHandle<unknown, AlertSheetViewOptions.RefAttributes>(ref, () => ({
30
- show: async (options: Partial<AlertSheetViewOptions>) => {
31
- setState(Object.assign({}, defaultState, { visible: true }, options))
32
- },
33
- hide
34
- }), [])
35
-
36
-
37
- const hide = async () => {
38
- setState(defaultState)
39
- }
40
-
41
-
42
- React.useEffect(() => {
43
- if (Platform.OS == 'android') {
44
- if (state.visible) {
45
- StatusBar.setBackgroundColor('black')
46
- StatusBar.setBarStyle('light-content')
47
- } else {
48
- StatusBar.setBackgroundColor('transparent')
49
- StatusBar.setBarStyle('dark-content')
50
- }
51
- }
52
-
53
- }, [state.visible])
54
- return (
55
- <Modal
56
- hideModalContentWhileAnimating={true}//通过隐藏模态内容直到动画完成来增强性能
57
- useNativeDriver={true}//定义动画是否应使用本机驱动程序
58
- animationIn='slideInUp'
59
- animationOut='slideOutDown'
60
- onBackButtonPress={() => {
61
- //按下Android后退按钮时调用
62
- hide()
63
- }}
64
- onBackdropPress={() => {
65
- //按下背景时调用
66
- hide()
67
- }}
68
- isVisible={state.visible}
69
- deviceHeight={Dimensions.get('screen').height}
70
- style={{ margin: 0}}
71
- >
72
- <View style={styles.container}>
73
- <View style={[styles.wrapper]}>
74
- <View style={styles.itemContainer}>
75
- {state.actions?.map((i, idx) =>
76
- <TouchableOpacity
77
-
78
- key={`sg-action-${idx}`}
79
- style={[styles.item]}
80
- activeOpacity={1}
81
- onPress={() => {
82
- hide()
83
- i.onClick && i.onClick()
84
- }}>
85
- <Text style={[styles.itemText,{color:i.color}]} numberOfLines={2}>{i.text}</Text>
86
- </TouchableOpacity>
87
- )}
88
- </View>
89
-
90
-
91
-
92
- <TouchableOpacity
93
- style={[styles.cancel]}
94
- activeOpacity={1}
95
- onPress={() => {
96
- hide()
97
- }}>
98
- <Text style={[styles.cancelText]}>取消</Text>
99
- </TouchableOpacity>
100
- </View>
101
-
102
- </View>
103
- </Modal>
104
- )
105
- })
106
-
107
-
108
-
109
- export const alertSheetViewRef = React.createRef<AlertSheetViewOptions.RefAttributes>();
110
-
111
-
112
-
113
- export const showAlertSheetModal = (props: Partial<AlertSheetViewOptions>) => {
114
- alertSheetViewRef.current?.show(props)
115
- }
116
-
117
-
118
-
119
-
120
-
121
-
122
- const styles = StyleSheet.create({
123
- container: {
124
- display: 'flex',
125
- flexGrow: 1,
126
- justifyContent: 'flex-end',
127
- alignItems: 'center',
128
-
129
- },
130
-
131
- wrapper: {
132
- flexGrow: 0,
133
- flexShrink: 0,
134
- width: '100%',
135
- // backgroundColor: 'pink',
136
- overflow: 'hidden',
137
- borderTopLeftRadius: px2dp(10),
138
- borderTopRightRadius: px2dp(10),
139
- display: 'flex',
140
- padding: px2dp(15),
141
- },
142
-
143
- cancel: {
144
- height: px2dp(50),
145
- display: 'flex',
146
- justifyContent: 'center',
147
- alignItems: 'center',
148
- borderRadius: px2dp(10),
149
- backgroundColor: 'white',
150
- marginTop: px2dp(15),
151
- },
152
- cancelText: {
153
- fontSize: px2sp(15),
154
- color: '#2763FF',
155
-
156
- },
157
-
158
- itemContainer: {
159
- display: 'flex',
160
- borderRadius: px2dp(10),
161
- overflow: 'hidden',
162
- backgroundColor:'#f1f1f1'
163
- },
164
- item: {
165
- height: px2dp(50),
166
- display: 'flex',
167
- justifyContent: 'center',
168
- alignItems: 'center',
169
-
170
- backgroundColor: 'white',
171
- marginTop: px2dp(0.75)
172
- },
173
- itemText: {
174
- fontSize: px2sp(12),
175
- color: '#666666',
176
-
177
- },
178
-
179
- })