@aks-dev/easyui 1.0.10
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/LICENSE +21 -0
- package/README.md +35 -0
- package/android/build.gradle +44 -0
- package/android/src/main/AndroidManifest.xml +20 -0
- package/android/src/main/java/com/easyui/RNEasyuiModule.java +29 -0
- package/android/src/main/java/com/easyui/RNEasyuiPackage.java +38 -0
- package/android/src/main/java/com/easyui/UpgradeModule.java +54 -0
- package/ios/RNEasyui.h +18 -0
- package/ios/RNEasyui.m +13 -0
- package/ios/RNEasyui.podspec +24 -0
- package/ios/RNEasyui.xcodeproj/project.pbxproj +259 -0
- package/ios/RNEasyui.xcworkspace/contents.xcworkspacedata +9 -0
- package/ios/UpgradeModule.h +12 -0
- package/ios/UpgradeModule.m +38 -0
- package/jsbridge/RNEasyui.tsx +13 -0
- package/jsbridge/UpgradeModule.tsx +13 -0
- package/jsbridge/index.ts +13 -0
- package/lib/Badge/Badge.tsx +39 -0
- package/lib/Badge/index.ts +21 -0
- package/lib/Easy-Hud/AlertView/AlertView.tsx +233 -0
- package/lib/Easy-Hud/AlertView/index.ts +41 -0
- package/lib/Easy-Hud/EasyHud.tsx +48 -0
- package/lib/Easy-Hud/Loading/Loading.tsx +80 -0
- package/lib/Easy-Hud/Loading/index.ts +35 -0
- package/lib/Easy-Hud/Toast/Toast.tsx +86 -0
- package/lib/Easy-Hud/Toast/index.ts +22 -0
- package/lib/Easy-Hud/index.ts +18 -0
- package/lib/Echarts/EchartsView.tsx +151 -0
- package/lib/Echarts/demo.tsx +235 -0
- package/lib/Echarts/helper.tsx +63 -0
- package/lib/Echarts/index.ts +29 -0
- package/lib/Modal/Modal.tsx +12 -0
- package/lib/Modal/index.ts +10 -0
- package/lib/MutiPictureView/MutiPictureView.tsx +213 -0
- package/lib/MutiPictureView/icon_add_image.png +0 -0
- package/lib/MutiPictureView/icon_del_image.png +0 -0
- package/lib/MutiPictureView/index.ts +55 -0
- package/lib/PictureViewer/PictureViewer.tsx +80 -0
- package/lib/PictureViewer/index.ts +26 -0
- package/lib/RefreshList/RefreshList.tsx +222 -0
- package/lib/RefreshList/demo.tsx +30 -0
- package/lib/RefreshList/demo1.tsx +60 -0
- package/lib/RefreshList/demo2.tsx +46 -0
- package/lib/RefreshList/index.ts +84 -0
- package/lib/StickHeaderView/StickHeaderView.tsx +65 -0
- package/lib/StickHeaderView/demo.tsx +104 -0
- package/lib/StickHeaderView/index.ts +26 -0
- package/lib/TableCell/TableCell.tsx +117 -0
- package/lib/TableCell/back.png +0 -0
- package/lib/TableCell/index.ts +45 -0
- package/lib/TextInputArea/TextInputArea.tsx +88 -0
- package/lib/TextInputArea/index.ts +32 -0
- package/lib/WithLoadingContainer/WithLoadingContainer.tsx +93 -0
- package/lib/WithLoadingContainer/index.ts +36 -0
- package/lib/WithLoadingContainer/loading.gif +0 -0
- package/lib/WithLoadingContainer/loading3.gif +0 -0
- package/package.json +59 -0
- package/screen/index.ts +16 -0
- package/screen/px2dp.tsx +44 -0
- package/screen/px2sp.tsx +65 -0
- package/screen/text-set.tsx +58 -0
- package/src/index.d.ts +58 -0
- package/src/index.ts +66 -0
- package/utils/index.ts +56 -0
- package/utils/lazy.tsx +40 -0
- package/utils/mode.tsx +48 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-21 14:40:29
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 14:05:59
|
|
6
|
+
* @FilePath: /@aks/easy/lib/Badge/Badge.tsx
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react'
|
|
9
|
+
import { View, Text, } from 'react-native'
|
|
10
|
+
import {px2dp} from '../../screen/px2dp'
|
|
11
|
+
import {px2sp} from '../../screen/px2sp'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import type { BadgeProps } from '.'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const Badge: React.FC<BadgeProps> = (props) => {
|
|
19
|
+
return (
|
|
20
|
+
|
|
21
|
+
<View style={
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
flexGrow: 0, flexShrink: 1, zIndex: 1,
|
|
25
|
+
paddingHorizontal: px2dp(4),
|
|
26
|
+
height: px2dp(16), minWidth: px2dp(16), borderRadius: px2dp(8),
|
|
27
|
+
justifyContent: 'center', alignItems: 'center', backgroundColor: 'red'
|
|
28
|
+
},
|
|
29
|
+
props.style
|
|
30
|
+
]
|
|
31
|
+
} >
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<Text style={{ fontSize: px2sp(12), color: 'white', lineHeight: px2dp(16), textAlign: 'center' }}> {props.count > 99 ? '+99' : props.count} </Text>
|
|
35
|
+
|
|
36
|
+
</View>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-21 14:43:14
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 10:49:39
|
|
6
|
+
* @FilePath: /@aks/easy/lib/Badge/index.ts
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react'
|
|
9
|
+
import { StyleProp, ViewStyle } from 'react-native'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export declare type BadgeProps = {
|
|
16
|
+
count: number;
|
|
17
|
+
style?: StyleProp<ViewStyle>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare const Badge : React.FC<BadgeProps>
|
|
21
|
+
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing } from 'react-native'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { px2dp, deviceWidth } from '../../../screen/px2dp'
|
|
6
|
+
import { px2sp } from '../../../screen/px2sp'
|
|
7
|
+
|
|
8
|
+
import { Options, AlertViewCurrent } from '.'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type State = {
|
|
13
|
+
visible: boolean;
|
|
14
|
+
|
|
15
|
+
} & Omit<Options, 'cancel' | 'confirm'>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export default React.forwardRef<AlertViewCurrent, {}>((_, 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, AlertViewCurrent>(ref, () => ({
|
|
36
|
+
show: async (options: Partial<Options>) => {
|
|
37
|
+
|
|
38
|
+
setState(Object.assign({}, defaultState, { visible: true }, options))
|
|
39
|
+
cancelCallbackRef.current = options.cancel;
|
|
40
|
+
confirmCallbackRef.current = options.confirm;
|
|
41
|
+
// await sleep(50)
|
|
42
|
+
startAnimate(1)
|
|
43
|
+
},
|
|
44
|
+
hide
|
|
45
|
+
}), [])
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const hide = async () => {
|
|
49
|
+
startAnimate(0.3)
|
|
50
|
+
// await sleep(50)
|
|
51
|
+
setState(defaultState)
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let scale_anim = React.useRef(new Animated.Value(0.3)).current
|
|
56
|
+
const startAnimate = (x: number) => {
|
|
57
|
+
Animated.timing(scale_anim, {
|
|
58
|
+
toValue: x,
|
|
59
|
+
useNativeDriver: true,
|
|
60
|
+
duration: 150,
|
|
61
|
+
easing: Easing.ease
|
|
62
|
+
}).start()
|
|
63
|
+
}
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
if (Platform.OS == 'android') {
|
|
66
|
+
if (state.visible) {
|
|
67
|
+
StatusBar.setBackgroundColor('black')
|
|
68
|
+
StatusBar.setBarStyle('light-content')
|
|
69
|
+
} else {
|
|
70
|
+
StatusBar.setBackgroundColor('transparent')
|
|
71
|
+
StatusBar.setBarStyle('dark-content')
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}, [state.visible])
|
|
76
|
+
return (
|
|
77
|
+
<Modal
|
|
78
|
+
visible={state.visible}
|
|
79
|
+
transparent animationType="fade"
|
|
80
|
+
onRequestClose={() => {
|
|
81
|
+
// hide()
|
|
82
|
+
}}
|
|
83
|
+
// style={{
|
|
84
|
+
// margin: 0,
|
|
85
|
+
// }}
|
|
86
|
+
>
|
|
87
|
+
<View style={styles.container}>
|
|
88
|
+
<Animated.View style={[styles.wrapper, state.wrapperStyle, { transform: [{ scale: scale_anim }] }]}>
|
|
89
|
+
{state.title && <Text style={styles.titleText}>{state.title}</Text>}
|
|
90
|
+
{(() => {
|
|
91
|
+
if (typeof state.content == 'string') return <Text style={styles.contentText}>{state.content}</Text>
|
|
92
|
+
if (React.isValidElement(state.content)) return state.content;
|
|
93
|
+
return <View />
|
|
94
|
+
})()}
|
|
95
|
+
|
|
96
|
+
{
|
|
97
|
+
(state.cancelText || state.confirmText) &&
|
|
98
|
+
<View style={styles.action}>
|
|
99
|
+
{state.cancelText &&
|
|
100
|
+
<TouchableOpacity
|
|
101
|
+
style={[styles.cancel, { marginRight: state.confirmText ? px2dp(15) : 0 }, state.cancelContainerStyle]}
|
|
102
|
+
activeOpacity={0.8}
|
|
103
|
+
onPress={() => {
|
|
104
|
+
hide()
|
|
105
|
+
cancelCallbackRef.current && cancelCallbackRef.current()
|
|
106
|
+
cancelCallbackRef.current = undefined;
|
|
107
|
+
|
|
108
|
+
}}>
|
|
109
|
+
<Text style={[styles.cancelText, state.cancelTextStyle]}>{state.cancelText}</Text>
|
|
110
|
+
</TouchableOpacity>
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
{state.confirmText &&
|
|
114
|
+
<TouchableOpacity
|
|
115
|
+
style={[styles.confirm, { marginLeft: state.cancelText ? px2dp(15) : 0 }, state.confirmContainerStyle]}
|
|
116
|
+
activeOpacity={0.8}
|
|
117
|
+
onPress={() => {
|
|
118
|
+
hide()
|
|
119
|
+
confirmCallbackRef.current && confirmCallbackRef.current()
|
|
120
|
+
confirmCallbackRef.current = undefined;
|
|
121
|
+
}}>
|
|
122
|
+
<Text style={[styles.confirmText, state.confirmTextStyle]}>{state.confirmText}</Text>
|
|
123
|
+
</TouchableOpacity>
|
|
124
|
+
}
|
|
125
|
+
</View>
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
</Animated.View>
|
|
129
|
+
|
|
130
|
+
</View>
|
|
131
|
+
</Modal>
|
|
132
|
+
)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
export const alertViewRef = React.createRef<AlertViewCurrent>();
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
export const ShowAlertModal = (props: Partial<Options>) => {
|
|
142
|
+
alertViewRef.current?.show(props)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
// const sleep = (msec?: number) => {
|
|
148
|
+
// return new Promise(resolve => {
|
|
149
|
+
// setTimeout(resolve, msec || 350);
|
|
150
|
+
// });
|
|
151
|
+
// }
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
const styles = StyleSheet.create({
|
|
156
|
+
container: {
|
|
157
|
+
display: 'flex',
|
|
158
|
+
flexGrow: 1,
|
|
159
|
+
backgroundColor: '#00000088',
|
|
160
|
+
justifyContent: 'center',
|
|
161
|
+
alignItems: 'center',
|
|
162
|
+
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
wrapper: {
|
|
166
|
+
flexGrow: 0,
|
|
167
|
+
flexShrink: 0,
|
|
168
|
+
// minWidth: '70%',
|
|
169
|
+
minWidth: deviceWidth - px2dp(60),
|
|
170
|
+
backgroundColor: 'white',
|
|
171
|
+
overflow: 'hidden',
|
|
172
|
+
borderRadius: px2dp(10),
|
|
173
|
+
display: 'flex',
|
|
174
|
+
padding: px2dp(15),
|
|
175
|
+
},
|
|
176
|
+
titleText: {
|
|
177
|
+
maxWidth: deviceWidth - px2dp(90),
|
|
178
|
+
fontSize: px2sp(18),
|
|
179
|
+
marginBottom: px2dp(20),
|
|
180
|
+
// backgroundColor: 'red',
|
|
181
|
+
textAlign: 'center',
|
|
182
|
+
fontWeight: 'bold',
|
|
183
|
+
color: '#1A1A1A'
|
|
184
|
+
},
|
|
185
|
+
contentText: {
|
|
186
|
+
maxWidth: deviceWidth - px2dp(90),
|
|
187
|
+
marginBottom: px2dp(20),
|
|
188
|
+
minHeight: px2dp(40),
|
|
189
|
+
flexGrow: 0,
|
|
190
|
+
flexShrink: 1,
|
|
191
|
+
width: undefined,
|
|
192
|
+
fontSize: px2sp(15),
|
|
193
|
+
// backgroundColor: 'red',
|
|
194
|
+
color: '#1A1A1A',
|
|
195
|
+
textAlign: 'center'
|
|
196
|
+
},
|
|
197
|
+
action: {
|
|
198
|
+
display: 'flex',
|
|
199
|
+
flexDirection: 'row',
|
|
200
|
+
justifyContent: 'space-between',
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
// backgroundColor:"red"
|
|
203
|
+
},
|
|
204
|
+
cancel: {
|
|
205
|
+
width: '40%',
|
|
206
|
+
height: px2dp(44),
|
|
207
|
+
display: 'flex',
|
|
208
|
+
justifyContent: 'center',
|
|
209
|
+
alignItems: 'center',
|
|
210
|
+
borderRadius: px2dp(10),
|
|
211
|
+
borderWidth: px2dp(1),
|
|
212
|
+
borderColor: '#A3A9CC'
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
confirm: {
|
|
216
|
+
width: '40%',
|
|
217
|
+
height: px2dp(44),
|
|
218
|
+
display: 'flex',
|
|
219
|
+
justifyContent: 'center',
|
|
220
|
+
alignItems: 'center',
|
|
221
|
+
backgroundColor: '#2763FF',
|
|
222
|
+
borderRadius: px2dp(10)
|
|
223
|
+
},
|
|
224
|
+
cancelText: {
|
|
225
|
+
fontSize: px2sp(15),
|
|
226
|
+
color: '#A3A9CC',
|
|
227
|
+
|
|
228
|
+
},
|
|
229
|
+
confirmText: {
|
|
230
|
+
fontSize: px2sp(15),
|
|
231
|
+
color: 'white'
|
|
232
|
+
},
|
|
233
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-22 17:30:32
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 14:11:39
|
|
6
|
+
* @FilePath: /@aks/easy/lib/Easy-Hud/AlertView/index.ts
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export declare type Options = {
|
|
15
|
+
title: string;
|
|
16
|
+
content: string | React.ReactElement;
|
|
17
|
+
wrapperStyle: StyleProp<ViewStyle>;
|
|
18
|
+
cancelText: string;
|
|
19
|
+
cancelContainerStyle: StyleProp<ViewStyle>;
|
|
20
|
+
cancelTextStyle: StyleProp<TextStyle>;
|
|
21
|
+
cancel: () => void;
|
|
22
|
+
confirmText: string;
|
|
23
|
+
confirmContainerStyle: StyleProp<ViewStyle>;
|
|
24
|
+
confirmTextStyle: StyleProp<TextStyle>;
|
|
25
|
+
confirm: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export declare const ShowAlertModal: (props: Partial<Options>) => void;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export declare type AlertViewCurrent = {
|
|
34
|
+
show: (options: Partial<Options>) => void;
|
|
35
|
+
hide: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export declare const AlertView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertViewCurrent>>;
|
|
40
|
+
|
|
41
|
+
export declare const alertViewRef: React.RefObject<AlertViewCurrent>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 14:10:04
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-05-10 09:15:52
|
|
6
|
+
* @FilePath: /@aks/easyui/lib/Easy-Hud/EasyHud.tsx
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react'
|
|
9
|
+
// import { StyleSheet } from 'react-native'
|
|
10
|
+
import {
|
|
11
|
+
alertViewRef, default as AlertView, ShowAlertModal
|
|
12
|
+
} from './AlertView/AlertView'
|
|
13
|
+
import {
|
|
14
|
+
HideLoading, Loading, loadingRef, ShowLoading
|
|
15
|
+
} from './Loading/Loading'
|
|
16
|
+
import {
|
|
17
|
+
ShowToast, Toast, toastRef
|
|
18
|
+
} from './Toast/Toast'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export const EasyHud: React.FC<{}> = () => React.cloneElement(
|
|
29
|
+
<></>,
|
|
30
|
+
{
|
|
31
|
+
// ...StyleSheet.absoluteFillObject,
|
|
32
|
+
// display: 'flex',
|
|
33
|
+
},
|
|
34
|
+
[
|
|
35
|
+
<Loading key="hud-0" ref={loadingRef} />,
|
|
36
|
+
<Toast key="hud-1" ref={toastRef} />,
|
|
37
|
+
<AlertView key="hud-2" ref={alertViewRef} />
|
|
38
|
+
|
|
39
|
+
]
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
ShowAlertModal,
|
|
45
|
+
ShowToast,
|
|
46
|
+
ShowLoading,
|
|
47
|
+
HideLoading
|
|
48
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 14:27:02
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-05-07 17:30:04
|
|
6
|
+
* @FilePath: /@aks/easyui/lib/Easy-Hud/Loading/Loading.tsx
|
|
7
|
+
*/
|
|
8
|
+
import React, { useImperativeHandle, useState } from 'react';
|
|
9
|
+
import { View, ActivityIndicator, StyleSheet, Text, Dimensions,TouchableOpacity } from 'react-native';
|
|
10
|
+
|
|
11
|
+
import type { LoadingCurrent } from '.'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export const Loading = React.forwardRef<LoadingCurrent, {}>((_, ref) => {
|
|
18
|
+
const [show, setShow] = useState(false);
|
|
19
|
+
const [tipText, setTipText] = useState('加载中');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
useImperativeHandle<unknown, LoadingCurrent>(ref, () => ({
|
|
23
|
+
ShowLoading: (content?: string) => {
|
|
24
|
+
setShow(true);
|
|
25
|
+
setTipText(content || '加载中')
|
|
26
|
+
},
|
|
27
|
+
HideLoading: () => {
|
|
28
|
+
setShow(false);
|
|
29
|
+
}
|
|
30
|
+
}), [show])
|
|
31
|
+
|
|
32
|
+
if (!show)
|
|
33
|
+
return null;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<TouchableOpacity disabled style={styles.container}>
|
|
37
|
+
<View style={styles.warpper}>
|
|
38
|
+
<ActivityIndicator color="white" size='large' />
|
|
39
|
+
<Text numberOfLines={5} style={styles.title}>{tipText}
|
|
40
|
+
</Text>
|
|
41
|
+
</View>
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
export const loadingRef = React.createRef<LoadingCurrent>();
|
|
47
|
+
export const ShowLoading = (content?: string) => loadingRef.current?.ShowLoading(content)
|
|
48
|
+
export const HideLoading = () => loadingRef.current?.HideLoading()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
container: {
|
|
55
|
+
...StyleSheet.absoluteFillObject,
|
|
56
|
+
display: 'flex',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
// backgroundColor:'red'
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
warpper: {
|
|
63
|
+
backgroundColor: '#00000088',
|
|
64
|
+
padding: 40,
|
|
65
|
+
paddingVertical: 20,
|
|
66
|
+
borderRadius: 10,
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
minWidth: 90
|
|
70
|
+
},
|
|
71
|
+
title: {
|
|
72
|
+
marginTop: 5,
|
|
73
|
+
fontSize: 13,
|
|
74
|
+
lineHeight: 16,
|
|
75
|
+
color: 'white',
|
|
76
|
+
maxWidth: SCREEN_WIDTH * 0.5,
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* @Author: shiguo
|
|
4
|
+
* @Date: 2022-04-24 14:27:02
|
|
5
|
+
* @LastEditors: shiguo
|
|
6
|
+
* @LastEditTime: 2022-05-07 16:04:06
|
|
7
|
+
* @FilePath: /@aks/easyui/lib/Easy-Hud/Loading/index.ts
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export declare type LoadingCurrent = {
|
|
19
|
+
ShowLoading: (content?: string) => void;
|
|
20
|
+
HideLoading: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export declare const ShowLoading: (content?: string) => void;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export declare const HideLoading: () => void;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export declare const loadingRef: React.RefObject<LoadingCurrent>;
|
|
33
|
+
|
|
34
|
+
export declare const Loading: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<LoadingCurrent>>
|
|
35
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2021-04-27 10:38:04
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 14:11:13
|
|
6
|
+
* @FilePath: /@aks/easy/lib/Easy-Hud/Toast/Toast.tsx
|
|
7
|
+
*/
|
|
8
|
+
import React, { useImperativeHandle, useState, useRef } from 'react';
|
|
9
|
+
import { View, StyleSheet, Text, Dimensions, Animated, Easing } from 'react-native';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import type { ToastCurrent } from '.'
|
|
13
|
+
|
|
14
|
+
const errorMsg = '(^_^)∠※ 送你一束小花'
|
|
15
|
+
|
|
16
|
+
export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
|
|
17
|
+
const [tipText, setTipText] = useState(errorMsg);
|
|
18
|
+
const fade = useRef(new Animated.Value(0)).current;
|
|
19
|
+
|
|
20
|
+
const fadeAnimation = Animated.sequence([
|
|
21
|
+
Animated.timing(fade, {
|
|
22
|
+
toValue: 1,
|
|
23
|
+
duration: 750,
|
|
24
|
+
useNativeDriver: true,
|
|
25
|
+
easing: Easing.linear,
|
|
26
|
+
}),
|
|
27
|
+
Animated.delay(3000),
|
|
28
|
+
Animated.timing(fade, {
|
|
29
|
+
toValue: 0,
|
|
30
|
+
duration: 750,
|
|
31
|
+
useNativeDriver: true,
|
|
32
|
+
easing: Easing.linear,
|
|
33
|
+
})
|
|
34
|
+
])
|
|
35
|
+
|
|
36
|
+
useImperativeHandle<unknown, ToastCurrent>(ref, () => ({
|
|
37
|
+
ShowToast: (content: string) => {
|
|
38
|
+
setTipText(content || errorMsg)
|
|
39
|
+
fadeAnimation.reset()
|
|
40
|
+
fadeAnimation.start()
|
|
41
|
+
},
|
|
42
|
+
}))
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
|
|
46
|
+
<View style={styles.toastTipsContainer}>
|
|
47
|
+
<Text numberOfLines={5} style={{ ...styles.toastTitle, }}>{tipText} </Text>
|
|
48
|
+
</View>
|
|
49
|
+
</Animated.View>
|
|
50
|
+
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export const toastRef = React.createRef<ToastCurrent>();
|
|
55
|
+
|
|
56
|
+
export const ShowToast = (content: string) => toastRef.current?.ShowToast(content)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
61
|
+
const styles = StyleSheet.create({
|
|
62
|
+
toastContainer: {
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
bottom: 100,
|
|
65
|
+
width: '100%',
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
alignItems: 'center'
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
toastTipsContainer: {
|
|
71
|
+
position: 'absolute',
|
|
72
|
+
backgroundColor: '#00000088',
|
|
73
|
+
padding: 10,
|
|
74
|
+
// paddingVertical: 4,
|
|
75
|
+
borderRadius: 2,
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
minWidth: 120
|
|
79
|
+
},
|
|
80
|
+
toastTitle: {
|
|
81
|
+
fontSize: 13,
|
|
82
|
+
lineHeight: 20,
|
|
83
|
+
color: 'white',
|
|
84
|
+
maxWidth: SCREEN_WIDTH * 0.8
|
|
85
|
+
}
|
|
86
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-18 19:18:03
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 14:11:06
|
|
6
|
+
* @FilePath: /@aks/easy/lib/Easy-Hud/Toast/index.ts
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export declare type ToastCurrent = {
|
|
14
|
+
ShowToast: (content: string) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare const ShowToast: (content: string) => void;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export declare const toastRef: React.RefObject<ToastCurrent>;
|
|
21
|
+
|
|
22
|
+
export declare const Toast: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<ToastCurrent>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 14:14:42
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 14:14:40
|
|
6
|
+
* @FilePath: /@aks/easy/lib/Easy-Hud/index.ts
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import * as React from 'react'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export * from './AlertView'
|
|
14
|
+
export * from './Loading'
|
|
15
|
+
export * from './Toast'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export declare const EasyHud: React.FC<{}>
|