@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.
- package/dist/components/AnimationModal/AnimationModal.d.ts +27 -0
- package/dist/components/AnimationModal/AnimationModal.d.ts.map +1 -0
- package/dist/components/AnimationModal/AnimationModal.js +151 -0
- package/dist/components/Badge/Badge.d.ts +8 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.js +35 -0
- package/dist/components/DottedLine/DottedLine.d.ts +10 -0
- package/dist/components/DottedLine/DottedLine.d.ts.map +1 -0
- package/dist/components/DottedLine/DottedLine.js +50 -0
- package/dist/components/EchartsView/EchartsView.d.ts +10 -0
- package/dist/components/EchartsView/EchartsView.d.ts.map +1 -0
- package/{lib/Echarts/EchartsView.tsx → dist/components/EchartsView/EchartsView.js} +74 -113
- package/dist/components/EchartsView/helper.d.ts +10 -0
- package/dist/components/EchartsView/helper.d.ts.map +1 -0
- package/{lib/Echarts/helper.tsx → dist/components/EchartsView/helper.js} +17 -24
- package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts +25 -0
- package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -0
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +174 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts +19 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +117 -0
- package/dist/components/Hud/AlertView/AlertView.d.ts +25 -0
- package/dist/components/Hud/AlertView/AlertView.d.ts.map +1 -0
- package/dist/components/Hud/AlertView/AlertView.js +184 -0
- package/dist/components/Hud/Hud.d.ts +11 -0
- package/dist/components/Hud/Hud.d.ts.map +1 -0
- package/dist/components/Hud/Hud.js +29 -0
- package/dist/components/Hud/Loading/Loading.d.ts +11 -0
- package/dist/components/Hud/Loading/Loading.d.ts.map +1 -0
- package/dist/components/Hud/Loading/Loading.js +66 -0
- package/dist/components/Hud/PopoverView/PopoverView.d.ts +17 -0
- package/dist/components/Hud/PopoverView/PopoverView.d.ts.map +1 -0
- package/dist/components/Hud/PopoverView/PopoverView.js +47 -0
- package/dist/components/Hud/Scanner/Scanner.d.ts +12 -0
- package/dist/components/Hud/Scanner/Scanner.d.ts.map +1 -0
- package/dist/components/Hud/Scanner/Scanner.js +301 -0
- package/dist/components/Hud/Toast/Toast.d.ts +9 -0
- package/dist/components/Hud/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Hud/Toast/Toast.js +71 -0
- package/dist/components/MenuView/MenuView.d.ts +21 -0
- package/dist/components/MenuView/MenuView.d.ts.map +1 -0
- package/dist/components/MenuView/MenuView.js +184 -0
- package/dist/components/Modal/Modal.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/{lib/Modal/Modal.tsx → dist/components/Modal/Modal.js} +1 -4
- package/{lib/MutiPictureView/index.ts → dist/components/MutiPictureView/MutiPictureView.d.ts} +18 -31
- package/dist/components/MutiPictureView/MutiPictureView.d.ts.map +1 -0
- package/dist/components/MutiPictureView/MutiPictureView.js +243 -0
- package/dist/components/PictureViewer/PictureViewer.d.ts +17 -0
- package/dist/components/PictureViewer/PictureViewer.d.ts.map +1 -0
- package/dist/components/PictureViewer/PictureViewer.js +54 -0
- package/dist/components/RefreshList/RefreshList.d.ts +45 -0
- package/dist/components/RefreshList/RefreshList.d.ts.map +1 -0
- package/dist/components/RefreshList/RefreshList.js +155 -0
- package/dist/components/RichText/RichText.d.ts +12 -0
- package/dist/components/RichText/RichText.d.ts.map +1 -0
- package/dist/components/RichText/RichText.js +56 -0
- package/dist/components/StickHeaderView/StickHeaderView.d.ts +15 -0
- package/dist/components/StickHeaderView/StickHeaderView.d.ts.map +1 -0
- package/dist/components/StickHeaderView/StickHeaderView.js +37 -0
- package/{lib/TableCell/index.ts → dist/components/TableCell/TableCell.d.ts} +8 -30
- package/dist/components/TableCell/TableCell.d.ts.map +1 -0
- package/dist/components/TableCell/TableCell.js +97 -0
- package/dist/components/TextInputArea/TextInputArea.d.ts +17 -0
- package/dist/components/TextInputArea/TextInputArea.d.ts.map +1 -0
- package/dist/components/TextInputArea/TextInputArea.js +65 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts +23 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts.map +1 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +77 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/jsbridge/RNEasyui.d.ts +23 -0
- package/dist/jsbridge/RNEasyui.d.ts.map +1 -0
- package/dist/jsbridge/RNEasyui.js +46 -0
- package/dist/jsbridge/UpgradeModule.d.ts +26 -0
- package/dist/jsbridge/UpgradeModule.d.ts.map +1 -0
- package/{jsbridge/UpgradeModule.ts → dist/jsbridge/UpgradeModule.js} +25 -23
- package/dist/jsbridge/index.d.ts +3 -0
- package/dist/jsbridge/index.d.ts.map +1 -0
- package/{jsbridge/index.ts → dist/jsbridge/index.js} +2 -2
- package/dist/screen/index.d.ts +3 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/{screen/index.ts → dist/screen/index.js} +2 -2
- package/{screen/index.d.ts → dist/screen/px2dp.d.ts} +6 -12
- package/dist/screen/px2dp.d.ts.map +1 -0
- package/dist/screen/px2dp.js +45 -0
- package/dist/screen/px2sp.d.ts +2 -0
- package/dist/screen/px2sp.d.ts.map +1 -0
- package/{screen/px2sp.ts → dist/screen/px2sp.js} +13 -20
- package/dist/screen/text-fit.d.ts +5 -0
- package/dist/screen/text-fit.d.ts.map +1 -0
- package/{screen/text-fit.ts → dist/screen/text-fit.js} +10 -20
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/{utils/index.ts → dist/utils/index.js} +2 -2
- package/{utils/index.d.ts → dist/utils/lazy.d.ts} +15 -53
- package/dist/utils/lazy.d.ts.map +1 -0
- package/{utils/lazy.ts → dist/utils/lazy.js} +164 -165
- package/dist/utils/mode.d.ts +24 -0
- package/dist/utils/mode.d.ts.map +1 -0
- package/dist/utils/mode.js +50 -0
- package/package.json +32 -22
- package/readme.md +3 -3
- package/android/.DS_Store +0 -0
- package/android/src/.DS_Store +0 -0
- package/android/src/main/.DS_Store +0 -0
- package/android/src/main/java/.DS_Store +0 -0
- package/android/src/main/java/com/.DS_Store +0 -0
- package/android/src/main/java/com/easyui/.DS_Store +0 -0
- package/i.sh +0 -23
- package/ios/.DS_Store +0 -0
- package/ios/assets/.DS_Store +0 -0
- package/ios/views/.DS_Store +0 -0
- package/jsbridge/RNEasyui.ts +0 -42
- package/jsbridge/index.d.ts +0 -67
- package/lib/.DS_Store +0 -0
- package/lib/AnimationModal/AnimationModal.tsx +0 -201
- package/lib/AnimationModal/index.d.ts +0 -41
- package/lib/Badge/Badge.tsx +0 -40
- package/lib/Badge/index.ts +0 -21
- package/lib/DottedLine/DottedLine.tsx +0 -66
- package/lib/DottedLine/index.ts +0 -18
- package/lib/Echarts/demo.tsx +0 -235
- package/lib/Echarts/index.ts +0 -29
- package/lib/Hud/.DS_Store +0 -0
- package/lib/Hud/AlertBottomView/AlertBottomView.tsx +0 -228
- package/lib/Hud/AlertBottomView/index.d.ts +0 -42
- package/lib/Hud/AlertSheetView/AlertSheetView.tsx +0 -179
- package/lib/Hud/AlertSheetView/index.d.ts +0 -35
- package/lib/Hud/AlertView/AlertView.tsx +0 -234
- package/lib/Hud/AlertView/index.d.ts +0 -46
- package/lib/Hud/Hud.tsx +0 -67
- package/lib/Hud/Loading/Loading.tsx +0 -87
- package/lib/Hud/Loading/index.d.ts +0 -38
- package/lib/Hud/PopoverView/PopoverView.tsx +0 -66
- package/lib/Hud/PopoverView/index.d.ts +0 -39
- package/lib/Hud/Scanner/Scanner.tsx +0 -250
- package/lib/Hud/Scanner/index.d.ts +0 -42
- package/lib/Hud/Toast/Toast.tsx +0 -86
- package/lib/Hud/Toast/index.d.ts +0 -22
- package/lib/Hud/index.ts +0 -20
- package/lib/MenuView/MenuView.tsx +0 -252
- package/lib/MenuView/index.ts +0 -31
- package/lib/Modal/index.ts +0 -10
- package/lib/MutiPictureView/MutiPictureView.tsx +0 -259
- package/lib/PictureViewer/PictureViewer.tsx +0 -80
- package/lib/PictureViewer/index.ts +0 -26
- package/lib/RefreshList/RefreshList.tsx +0 -235
- package/lib/RefreshList/demo.tsx +0 -30
- package/lib/RefreshList/demo1.tsx +0 -60
- package/lib/RefreshList/demo2.tsx +0 -46
- package/lib/RefreshList/index.ts +0 -84
- package/lib/RichText/RichText.tsx +0 -82
- package/lib/RichText/index.ts +0 -21
- package/lib/StickHeaderView/StickHeaderView.tsx +0 -65
- package/lib/StickHeaderView/demo.tsx +0 -104
- package/lib/StickHeaderView/index.ts +0 -26
- package/lib/TableCell/TableCell.tsx +0 -118
- package/lib/TextInputArea/TextInputArea.tsx +0 -89
- package/lib/TextInputArea/index.d.ts +0 -33
- package/lib/WithLoadingContainer/WithLoadingContainer.tsx +0 -93
- package/lib/WithLoadingContainer/index.ts +0 -36
- package/screen/px2dp.ts +0 -51
- package/src/index.d.ts +0 -42
- package/src/index.ts +0 -54
- package/utils/mode.ts +0 -48
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-blue.png +0 -0
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-white.png +0 -0
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/icon_back_white.png +0 -0
- /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_add_image.png +0 -0
- /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_del_image.png +0 -0
- /package/{lib/TableCell → dist/components/TableCell/assets}/back.png +0 -0
- /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading.gif +0 -0
- /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading3.gif +0 -0
- /package/{lib → dist/components}/index.md +0 -0
package/{lib/MutiPictureView/index.ts → dist/components/MutiPictureView/MutiPictureView.d.ts}
RENAMED
|
@@ -1,40 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
* @Author: shiguo
|
|
4
|
-
* @Date: 2022-04-24 17:38:32
|
|
5
|
-
* @LastEditors: shiguo
|
|
6
|
-
* @LastEditTime: 2022-11-10 12:15:56
|
|
7
|
-
* @FilePath: /@aks-dev/easyui/lib/MutiPictureView/index.ts
|
|
8
|
-
*/
|
|
9
|
-
import { StyleProp, ViewStyle, ImageStyle, ImageSourcePropType } from 'react-native'
|
|
10
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ImageSourcePropType, StyleProp, ViewStyle, ImageStyle, TextStyle } from "react-native";
|
|
11
3
|
type ViewModelProps = {
|
|
12
4
|
photos?: any[];
|
|
13
5
|
/**@deprecated disabled 图片点击状态,已弃用*/
|
|
14
6
|
disabled?: boolean;
|
|
15
7
|
imageViewer: {
|
|
16
|
-
imageUrls: any[]
|
|
17
|
-
index: number
|
|
18
|
-
visible: boolean
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
imageUrls: any[];
|
|
9
|
+
index: number;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
23
13
|
type BindProps = {
|
|
24
14
|
viewModel: ViewModelProps;
|
|
25
|
-
setViewModel: (intent: Partial<ViewModelProps>) => void
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export declare type MutiPictureViewProps = {
|
|
15
|
+
setViewModel: (intent: Partial<ViewModelProps>) => void;
|
|
16
|
+
};
|
|
17
|
+
export type MutiPictureViewProps = {
|
|
31
18
|
/**@deprecated title 标题 ,已弃用*/
|
|
32
19
|
title?: string;
|
|
33
20
|
bind: BindProps;
|
|
34
21
|
/**default maxCount is 6 */
|
|
35
22
|
maxCount?: number;
|
|
36
23
|
/**default type is showImagePicker */
|
|
37
|
-
type?:
|
|
24
|
+
type?: "showImagePicker" | "openCamera";
|
|
38
25
|
style?: StyleProp<ViewStyle>;
|
|
39
26
|
addIcon?: ImageSourcePropType;
|
|
40
27
|
addIconStyle?: StyleProp<ImageStyle>;
|
|
@@ -51,13 +38,13 @@ export declare type MutiPictureViewProps = {
|
|
|
51
38
|
/**仅仅看看,不增减图片 */
|
|
52
39
|
editable?: boolean;
|
|
53
40
|
/**这个属性会覆盖bind.viewModel.photos */
|
|
54
|
-
value?: (string | {
|
|
41
|
+
value?: (string | {
|
|
42
|
+
uri: string;
|
|
43
|
+
})[];
|
|
55
44
|
/**default false 空视图占位 */
|
|
56
45
|
showEmptyPlaceHolder?: boolean;
|
|
57
46
|
emptyPlaceHolderStyle?: StyleProp<ViewStyle>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
};
|
|
48
|
+
declare const _default: React.NamedExoticComponent<MutiPictureViewProps>;
|
|
49
|
+
export default _default;
|
|
50
|
+
//# sourceMappingURL=MutiPictureView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutiPictureView.d.ts","sourceRoot":"","sources":["../../../src/components/MutiPictureView/MutiPictureView.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,mBAAmB,EAInB,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,cAAc,CAAC;AAMtB,KAAK,cAAc,GAAG;IACpB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE;QACX,SAAS,EAAE,GAAG,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,SAAS,EAAE,cAAc,CAAC;IAC1B,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACzD,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG;IACjC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,IAAI,CAAC,EAAE,iBAAiB,GAAG,YAAY,CAAC;IACxC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,YAAY,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,YAAY,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACrC,SAAS;IACT,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS;IACT,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IACrC,yBAAyB;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9C,CAAC;;AAuVF,wBAA4E"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: OBKoro1
|
|
3
|
+
* @Date: 2022-04-24 17:38:27
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-11-14 11:33:33
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/MutiPictureView/MutiPictureView.tsx
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Image, View, StyleSheet, Keyboard, TouchableOpacity, Text, } from "react-native";
|
|
10
|
+
import { px2dp } from "../../screen/px2dp";
|
|
11
|
+
import { px2sp } from "../../screen/px2sp";
|
|
12
|
+
let icon_add_image = require("./assets/icon_add_image.png");
|
|
13
|
+
let icon_del_image = require("./assets/icon_del_image.png");
|
|
14
|
+
const MutiPictureView = (props) => {
|
|
15
|
+
const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, //borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
|
|
16
|
+
itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
|
|
17
|
+
const { viewModel, setViewModel } = bind;
|
|
18
|
+
React.useEffect(() => { }, []);
|
|
19
|
+
const [sideLength, setSideLength] = React.useState(0);
|
|
20
|
+
const addPhoto = () => {
|
|
21
|
+
let images = viewModel.photos || [];
|
|
22
|
+
if (!images) {
|
|
23
|
+
throw new Error("viewModel没有定义photos字段");
|
|
24
|
+
}
|
|
25
|
+
// if (type == "showImagePicker") {
|
|
26
|
+
// SYImagePicker.showImagePicker(
|
|
27
|
+
// {
|
|
28
|
+
// imageCount: maxCount - (viewModel.photos?.length || 0),
|
|
29
|
+
// isCrop: false,
|
|
30
|
+
// isRecordSelected: false,
|
|
31
|
+
// quality: 20,
|
|
32
|
+
// },
|
|
33
|
+
// (err, photos) => {
|
|
34
|
+
// if (!err) {
|
|
35
|
+
// let imgs = photos.map((it) => {
|
|
36
|
+
// return { uri: it.uri };
|
|
37
|
+
// });
|
|
38
|
+
// images = images.concat(imgs);
|
|
39
|
+
// setViewModel({ photos: images });
|
|
40
|
+
// }
|
|
41
|
+
// },
|
|
42
|
+
// );
|
|
43
|
+
// }
|
|
44
|
+
// if (type == "openCamera") {
|
|
45
|
+
// SYImagePicker.openCamera(
|
|
46
|
+
// {
|
|
47
|
+
// imageCount: maxCount - (viewModel.photos?.length || 0),
|
|
48
|
+
// isCrop: false,
|
|
49
|
+
// isRecordSelected: false,
|
|
50
|
+
// quality: 20,
|
|
51
|
+
// },
|
|
52
|
+
// (err, photos) => {
|
|
53
|
+
// if (!err) {
|
|
54
|
+
// let imgs = photos.map((it) => {
|
|
55
|
+
// return { uri: it.uri };
|
|
56
|
+
// });
|
|
57
|
+
// images = images.concat(imgs);
|
|
58
|
+
// setViewModel({ photos: images });
|
|
59
|
+
// } else {
|
|
60
|
+
// console.log("打开相机失败");
|
|
61
|
+
// }
|
|
62
|
+
// },
|
|
63
|
+
// );
|
|
64
|
+
// }
|
|
65
|
+
};
|
|
66
|
+
const deletePhoto = (index) => {
|
|
67
|
+
Keyboard.dismiss();
|
|
68
|
+
let photos = [...(viewModel.photos || [])];
|
|
69
|
+
photos.splice(index, 1);
|
|
70
|
+
setViewModel({ photos: photos });
|
|
71
|
+
};
|
|
72
|
+
const showPhoto = (index) => {
|
|
73
|
+
Keyboard.dismiss();
|
|
74
|
+
let imgs = (props.value || viewModel.photos)?.filter((it) => {
|
|
75
|
+
return ((typeof it === "string" && it.indexOf("http") >= 0) ||
|
|
76
|
+
typeof it == "object");
|
|
77
|
+
}) || [];
|
|
78
|
+
let images = [];
|
|
79
|
+
// console.log('viewModel', viewModel, imgs)
|
|
80
|
+
imgs.forEach((it) => {
|
|
81
|
+
if (typeof it === "string") {
|
|
82
|
+
images.push({ uri: it });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
images.push(it);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
setViewModel({
|
|
89
|
+
imageViewer: {
|
|
90
|
+
imageUrls: images.map((it) => {
|
|
91
|
+
return it.uri;
|
|
92
|
+
}),
|
|
93
|
+
index: index,
|
|
94
|
+
visible: true,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const ItemView = ({ source, index, }) => {
|
|
99
|
+
return (<TouchableOpacity style={[
|
|
100
|
+
styles.item_container,
|
|
101
|
+
itemContainerStyle,
|
|
102
|
+
{
|
|
103
|
+
marginTop: index < 3 ? 0 : spacingInner,
|
|
104
|
+
marginLeft: index % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
105
|
+
width: sideLength,
|
|
106
|
+
height: sideLength,
|
|
107
|
+
},
|
|
108
|
+
]} activeOpacity={0.8} onPress={() => showPhoto(index)}>
|
|
109
|
+
<Image source={source} style={{ width: "100%", height: "100%" }} resizeMode="cover"/>
|
|
110
|
+
{editable && !props.value && (<TouchableOpacity onPress={() => deletePhoto(index)} style={[styles.del_img_container, delIconStyle]}>
|
|
111
|
+
<Image source={delIcon ? delIcon : icon_del_image} resizeMode="contain" style={{ width: "100%", height: "100%" }}/>
|
|
112
|
+
</TouchableOpacity>)}
|
|
113
|
+
</TouchableOpacity>);
|
|
114
|
+
};
|
|
115
|
+
const containerRef = React.useRef(null);
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
containerRef.current?.measure((...args) => {
|
|
118
|
+
// console.log('measure', args[2])
|
|
119
|
+
if (args.length > 3) {
|
|
120
|
+
let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) /
|
|
121
|
+
3).toFixed(1);
|
|
122
|
+
setSideLength(_sideLength - 0.1);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
if (props.value && props.value?.length > 0) {
|
|
127
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
128
|
+
{props.value instanceof Array &&
|
|
129
|
+
props.value?.map((item, index) => {
|
|
130
|
+
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
131
|
+
})}
|
|
132
|
+
|
|
133
|
+
{showEmptyPlaceHolder &&
|
|
134
|
+
maxCount - (props.value?.length || 0) - 1 > 0 &&
|
|
135
|
+
Array.from({
|
|
136
|
+
length: maxCount - (props.value?.length || 0) - (editable ? 1 : 0),
|
|
137
|
+
}, (_, k) => (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
138
|
+
styles.empty_place_container,
|
|
139
|
+
emptyPlaceHolderStyle,
|
|
140
|
+
itemContainerStyle,
|
|
141
|
+
{
|
|
142
|
+
marginTop: k + (editable ? 1 : 0) + (props.value?.length || 0) > 2
|
|
143
|
+
? spacingInner
|
|
144
|
+
: 0,
|
|
145
|
+
marginLeft: (k + (editable ? 1 : 0) + (props.value?.length || 0)) %
|
|
146
|
+
3 ==
|
|
147
|
+
0
|
|
148
|
+
? spacingHorizontal
|
|
149
|
+
: spacingInner,
|
|
150
|
+
width: sideLength,
|
|
151
|
+
height: sideLength,
|
|
152
|
+
},
|
|
153
|
+
]}/>))}
|
|
154
|
+
</View>);
|
|
155
|
+
}
|
|
156
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
157
|
+
{viewModel?.photos instanceof Array &&
|
|
158
|
+
viewModel.photos.map((item, index) => {
|
|
159
|
+
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
160
|
+
})}
|
|
161
|
+
|
|
162
|
+
{!(viewModel?.photos?.length == maxCount) && editable && (<TouchableOpacity style={[
|
|
163
|
+
styles.item_container,
|
|
164
|
+
itemContainerStyle,
|
|
165
|
+
{
|
|
166
|
+
marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
|
|
167
|
+
marginLeft: (viewModel?.photos?.length || 0) % 3 == 0
|
|
168
|
+
? spacingHorizontal
|
|
169
|
+
: spacingInner,
|
|
170
|
+
width: sideLength,
|
|
171
|
+
height: sideLength,
|
|
172
|
+
},
|
|
173
|
+
addIconContainerStyle,
|
|
174
|
+
]} activeOpacity={0.8} onPress={() => addPhoto()}>
|
|
175
|
+
<Image source={addIcon ? addIcon : icon_add_image} style={[{ width: "25%", height: "25%" }, addIconStyle]} resizeMode="contain"/>
|
|
176
|
+
{props.addText && (<Text style={[
|
|
177
|
+
{
|
|
178
|
+
fontSize: px2sp(12),
|
|
179
|
+
color: "lightgrey",
|
|
180
|
+
marginTop: px2dp(2),
|
|
181
|
+
},
|
|
182
|
+
props.addTextStyle,
|
|
183
|
+
]}>
|
|
184
|
+
{props.addText}
|
|
185
|
+
</Text>)}
|
|
186
|
+
</TouchableOpacity>)}
|
|
187
|
+
{showEmptyPlaceHolder &&
|
|
188
|
+
maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
|
|
189
|
+
Array.from({
|
|
190
|
+
length: maxCount - (viewModel.photos?.length || 0) - (editable ? 1 : 0),
|
|
191
|
+
}, (_, k) => (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
192
|
+
styles.empty_place_container,
|
|
193
|
+
emptyPlaceHolderStyle,
|
|
194
|
+
itemContainerStyle,
|
|
195
|
+
{
|
|
196
|
+
marginTop: k + (editable ? 1 : 0) + (viewModel.photos?.length || 0) > 2
|
|
197
|
+
? spacingInner
|
|
198
|
+
: 0,
|
|
199
|
+
marginLeft: (k + (editable ? 1 : 0) + (viewModel.photos?.length || 0)) %
|
|
200
|
+
3 ==
|
|
201
|
+
0
|
|
202
|
+
? spacingHorizontal
|
|
203
|
+
: spacingInner,
|
|
204
|
+
width: sideLength,
|
|
205
|
+
height: sideLength,
|
|
206
|
+
},
|
|
207
|
+
]}/>))}
|
|
208
|
+
</View>);
|
|
209
|
+
};
|
|
210
|
+
const styles = StyleSheet.create({
|
|
211
|
+
container: {
|
|
212
|
+
flex: 1,
|
|
213
|
+
minHeight: 1,
|
|
214
|
+
backgroundColor: "transparent",
|
|
215
|
+
display: "flex",
|
|
216
|
+
flexDirection: "row",
|
|
217
|
+
flexWrap: "wrap",
|
|
218
|
+
// borderRadius: px2dp(10),
|
|
219
|
+
},
|
|
220
|
+
item_container: {
|
|
221
|
+
overflow: "hidden",
|
|
222
|
+
borderRadius: px2dp(10),
|
|
223
|
+
display: "flex",
|
|
224
|
+
position: "relative",
|
|
225
|
+
justifyContent: "center",
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
backgroundColor: "#ededed",
|
|
228
|
+
},
|
|
229
|
+
del_img_container: {
|
|
230
|
+
position: "absolute",
|
|
231
|
+
right: 2,
|
|
232
|
+
top: 2,
|
|
233
|
+
width: px2dp(24),
|
|
234
|
+
height: px2dp(24),
|
|
235
|
+
},
|
|
236
|
+
empty_place_container: {
|
|
237
|
+
borderRadius: px2dp(10),
|
|
238
|
+
backgroundColor: "#ededed",
|
|
239
|
+
borderColor: "#cccccc",
|
|
240
|
+
borderWidth: 0.75,
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
export default React.memo(MutiPictureView, (prevProps, nextProps) => false);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type ViewModelProps = {
|
|
3
|
+
imageViewer: {
|
|
4
|
+
imageUrls: any[];
|
|
5
|
+
index: number;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type PictureViewerBindProps = {
|
|
10
|
+
viewModel: ViewModelProps;
|
|
11
|
+
setViewModel: (intent: Partial<ViewModelProps>) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const PictureViewer: React.FC<{
|
|
14
|
+
bind: PictureViewerBindProps;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=PictureViewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PictureViewer.d.ts","sourceRoot":"","sources":["../../../src/components/PictureViewer/PictureViewer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE;QACX,SAAS,EAAE,GAAG,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,cAAc,CAAC;IAC1B,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,sBAAsB,CAAA;CAAE,CA6DpE,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 15:58:39
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 12:38:13
|
|
6
|
+
* @FilePath: /@aks/easy/lib/PictureViewer/PictureViewer.tsx
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Modal, StatusBar, Platform } from "react-native";
|
|
10
|
+
import ImageViewer from "react-native-image-zoom-viewer";
|
|
11
|
+
export const PictureViewer = ({ bind, }) => {
|
|
12
|
+
const { viewModel, setViewModel } = bind;
|
|
13
|
+
const visible = viewModel.imageViewer.visible;
|
|
14
|
+
const imgs = viewModel.imageViewer.imageUrls?.map((item) => ({ url: item }));
|
|
15
|
+
const index = viewModel.imageViewer.index;
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (Platform.OS == "android") {
|
|
18
|
+
if (visible) {
|
|
19
|
+
StatusBar.setBackgroundColor("black");
|
|
20
|
+
StatusBar.setBarStyle("light-content");
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
StatusBar.setBackgroundColor("transparent");
|
|
24
|
+
StatusBar.setBarStyle("dark-content");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, [visible]);
|
|
28
|
+
return (<Modal presentationStyle="overFullScreen" visible={visible} transparent={false} onRequestClose={() => {
|
|
29
|
+
/**
|
|
30
|
+
* 【官方文档】
|
|
31
|
+
* onRequestClose回调会在用户按下 Android 设备上的后退按键或是 Apple TV 上的菜单键时触发。
|
|
32
|
+
* 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
|
|
33
|
+
*/
|
|
34
|
+
setViewModel({
|
|
35
|
+
imageViewer: {
|
|
36
|
+
...viewModel.imageViewer,
|
|
37
|
+
visible: false,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}} style={{ margin: 0, backgroundColor: "red" }}>
|
|
41
|
+
<ImageViewer imageUrls={imgs} index={index} onSwipeDown={() => {
|
|
42
|
+
// console.log('onSwipeDown');
|
|
43
|
+
}} saveToLocalByLongPress={false}
|
|
44
|
+
// onMove={data => console.log(data)}
|
|
45
|
+
useNativeDriver={true} enableSwipeDown={true} onClick={() => {
|
|
46
|
+
setViewModel({
|
|
47
|
+
imageViewer: {
|
|
48
|
+
...viewModel.imageViewer,
|
|
49
|
+
visible: false,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}}/>
|
|
53
|
+
</Modal>);
|
|
54
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FlatListProps, SectionListProps } from "react-native";
|
|
3
|
+
import { IPropsSwipeListView } from "react-native-swipe-list-view/types";
|
|
4
|
+
export declare const RefreshText: {
|
|
5
|
+
HeaderRefreshing: string;
|
|
6
|
+
FooterRefreshing: string;
|
|
7
|
+
Failure: string;
|
|
8
|
+
NoMoreData: string;
|
|
9
|
+
EmptyData: string;
|
|
10
|
+
Idle: string;
|
|
11
|
+
};
|
|
12
|
+
export declare enum RefreshState {
|
|
13
|
+
Idle = "Idle",
|
|
14
|
+
HeaderRefreshing = "HeaderRefreshing",
|
|
15
|
+
FooterRefreshing = "FooterRefreshing",
|
|
16
|
+
NoMoreData = "NoMoreData",
|
|
17
|
+
Failure = "Failure",
|
|
18
|
+
EmptyData = "EmptyData",
|
|
19
|
+
None = "None"
|
|
20
|
+
}
|
|
21
|
+
type CommonProps = {
|
|
22
|
+
onHeaderRefresh: (info: any) => void;
|
|
23
|
+
onFooterRefresh: (info: any) => void;
|
|
24
|
+
reload: () => void;
|
|
25
|
+
refreshState: RefreshState;
|
|
26
|
+
renderListEmptyComponent: () => React.ReactElement;
|
|
27
|
+
};
|
|
28
|
+
type SectionT = {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
type ItemT = any;
|
|
32
|
+
export type FlatListRefreshProps = {
|
|
33
|
+
mode?: "FlatList";
|
|
34
|
+
} & FlatListProps<ItemT> & Partial<CommonProps>;
|
|
35
|
+
export type SectionListRefreshProps = {
|
|
36
|
+
mode: "SectionList";
|
|
37
|
+
} & SectionListProps<ItemT, SectionT> & Partial<CommonProps>;
|
|
38
|
+
export type SwipeListViewRefreshProps = {
|
|
39
|
+
mode: "SwipeList";
|
|
40
|
+
data: ItemT[];
|
|
41
|
+
} & IPropsSwipeListView<ItemT> & Partial<CommonProps> & FlatListProps<ItemT>;
|
|
42
|
+
export type RefreshListProps = FlatListRefreshProps | SwipeListViewRefreshProps | SectionListRefreshProps;
|
|
43
|
+
declare const _default: React.ForwardRefExoticComponent<RefreshListProps & React.RefAttributes<any>>;
|
|
44
|
+
export default _default;
|
|
45
|
+
//# sourceMappingURL=RefreshList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshList.d.ts","sourceRoot":"","sources":["../../../src/components/RefreshList/RefreshList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAOL,aAAa,EACb,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AACF,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AACD,KAAK,WAAW,GAAG;IAEjB,eAAe,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,eAAe,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,wBAAwB,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;CACpD,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AACF,KAAK,KAAK,GAAG,GAAG,CAAC;AAEjB,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,GAAG,aAAa,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,WAAW,CAAC,CAAC;AAEvB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,aAAa,CAAC;CACrB,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,GACnC,OAAO,CAAC,WAAW,CAAC,CAAC;AAEvB,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,KAAK,EAAE,CAAC;CACf,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAC5B,OAAO,CAAC,WAAW,CAAC,GACpB,aAAa,CAAC,KAAK,CAAC,CAAC;AAEvB,MAAM,MAAM,gBAAgB,GACxB,oBAAoB,GACpB,yBAAyB,GACzB,uBAAuB,CAAC;;AAE5B,wBA8JE"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity, } from "react-native";
|
|
3
|
+
import { SwipeListView } from "react-native-swipe-list-view";
|
|
4
|
+
export const RefreshText = {
|
|
5
|
+
HeaderRefreshing: "上拉可以刷新",
|
|
6
|
+
FooterRefreshing: "下拉可以加载更多",
|
|
7
|
+
Failure: "服务器正在出小差,点击重新加载",
|
|
8
|
+
NoMoreData: "已经全部加载完毕",
|
|
9
|
+
EmptyData: "没有数据",
|
|
10
|
+
Idle: "正在加载更多的数据..",
|
|
11
|
+
};
|
|
12
|
+
export var RefreshState;
|
|
13
|
+
(function (RefreshState) {
|
|
14
|
+
RefreshState["Idle"] = "Idle";
|
|
15
|
+
RefreshState["HeaderRefreshing"] = "HeaderRefreshing";
|
|
16
|
+
RefreshState["FooterRefreshing"] = "FooterRefreshing";
|
|
17
|
+
RefreshState["NoMoreData"] = "NoMoreData";
|
|
18
|
+
RefreshState["Failure"] = "Failure";
|
|
19
|
+
RefreshState["EmptyData"] = "EmptyData";
|
|
20
|
+
RefreshState["None"] = "None";
|
|
21
|
+
})(RefreshState || (RefreshState = {}));
|
|
22
|
+
export default React.forwardRef((props, ref) => {
|
|
23
|
+
const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload, ...rest } = props;
|
|
24
|
+
const seed = React.useRef(Math.random()).current;
|
|
25
|
+
let onRefresh = () => {
|
|
26
|
+
if (refreshState == RefreshState.HeaderRefreshing)
|
|
27
|
+
return;
|
|
28
|
+
if (refreshState == RefreshState.FooterRefreshing)
|
|
29
|
+
return;
|
|
30
|
+
onHeaderRefresh && onHeaderRefresh(RefreshState.HeaderRefreshing);
|
|
31
|
+
};
|
|
32
|
+
let onEndReached = (info) => {
|
|
33
|
+
if (mode == "FlatList") {
|
|
34
|
+
props = props;
|
|
35
|
+
if (!(props.data instanceof Array)) {
|
|
36
|
+
throw new Error("[sg:FlatList] data is not Array");
|
|
37
|
+
}
|
|
38
|
+
if (props.data.length == 0)
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (mode == "SectionList") {
|
|
42
|
+
props = props;
|
|
43
|
+
if (!(props.sections instanceof Array)) {
|
|
44
|
+
throw new Error("[sg:SectionList] sections is not Array");
|
|
45
|
+
}
|
|
46
|
+
if (props.sections.length == 0)
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (refreshState != RefreshState.Idle)
|
|
50
|
+
return;
|
|
51
|
+
onFooterRefresh && onFooterRefresh(RefreshState.FooterRefreshing);
|
|
52
|
+
};
|
|
53
|
+
switch (mode) {
|
|
54
|
+
case "FlatList": {
|
|
55
|
+
let flatListProps = props;
|
|
56
|
+
return (<Animated.FlatList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} keyExtractor={(_, index) => {
|
|
57
|
+
return `sg-index-FlatList-${seed}-${index}`;
|
|
58
|
+
}} contentContainerStyle={flatListProps.data?.length ? {} : { height: "100%" }} onRefresh={onRefresh} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
59
|
+
<ListHeaderComponent {...flatListProps}/>
|
|
60
|
+
{/* {flatListProps.ListHeaderComponent} */}
|
|
61
|
+
</View>)}
|
|
62
|
+
// ListHeaderComponent={flatListProps.ListHeaderComponent}
|
|
63
|
+
ListFooterComponent={(_) => (<ListFooterComponent {...flatListProps}/>)}/>);
|
|
64
|
+
}
|
|
65
|
+
case "SectionList": {
|
|
66
|
+
let sectionListProps = props;
|
|
67
|
+
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = sectionListProps;
|
|
68
|
+
return (<Animated.SectionList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} onRefresh={onRefresh} keyExtractor={(_, index) => {
|
|
69
|
+
return `sg-index-SectionList-${seed}-${index}`;
|
|
70
|
+
}} contentContainerStyle={sectionListProps.sections?.length > 0 ? {} : { height: "100%" }} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false}
|
|
71
|
+
// ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
|
|
72
|
+
ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
73
|
+
<ListHeaderComponent {...sectionListProps}/>
|
|
74
|
+
{sectionListProps.ListHeaderComponent}
|
|
75
|
+
</View>)} ListFooterComponent={(_) => (<ListFooterComponent {...sectionListProps}/>)} renderSectionHeader={sectionListProps.renderSectionHeader}/>);
|
|
76
|
+
}
|
|
77
|
+
case "SwipeList": {
|
|
78
|
+
let swipeListProps = props;
|
|
79
|
+
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = swipeListProps;
|
|
80
|
+
const { renderHiddenItem = (data, rowMap) => (<View style={{
|
|
81
|
+
backgroundColor: "red",
|
|
82
|
+
height: "100%",
|
|
83
|
+
alignItems: "flex-end",
|
|
84
|
+
justifyContent: "center",
|
|
85
|
+
}}>
|
|
86
|
+
<Text>Right </Text>
|
|
87
|
+
</View>), } = swipeListProps;
|
|
88
|
+
return (<SwipeListView {...rest} rightOpenValue={-100} leftOpenValue={0} ref={ref} disableLeftSwipe={false} disableRightSwipe={true} onRefresh={onRefresh} refreshing={refreshState == RefreshState.HeaderRefreshing} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
89
|
+
<ListHeaderComponent {...swipeListProps}/>
|
|
90
|
+
{swipeListProps.ListHeaderComponent}
|
|
91
|
+
</View>)} ListFooterComponent={(args) => (<ListFooterComponent {...swipeListProps}/>)} renderHiddenItem={renderHiddenItem}/>);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const ListFooterComponent = React.memo((props) => {
|
|
96
|
+
const { refreshState, reload } = props;
|
|
97
|
+
switch (refreshState) {
|
|
98
|
+
case RefreshState.Idle:
|
|
99
|
+
case RefreshState.FooterRefreshing:
|
|
100
|
+
return (<View style={{ ...styles.container, flexDirection: "row" }}>
|
|
101
|
+
<ActivityIndicator color={"gray"}/>
|
|
102
|
+
<Text style={{ ...styles.text, marginLeft: 5 }}>
|
|
103
|
+
{RefreshText.FooterRefreshing}
|
|
104
|
+
</Text>
|
|
105
|
+
</View>);
|
|
106
|
+
case RefreshState.NoMoreData:
|
|
107
|
+
return (<View style={styles.container}>
|
|
108
|
+
<Text style={{ ...styles.text, color: "#999999" }}>
|
|
109
|
+
{RefreshText.NoMoreData}
|
|
110
|
+
</Text>
|
|
111
|
+
</View>);
|
|
112
|
+
case RefreshState.Failure:
|
|
113
|
+
return (<View style={styles.container}>
|
|
114
|
+
<TouchableOpacity onPress={() => reload && reload()}>
|
|
115
|
+
<Text style={styles.text}>{RefreshText.Failure}</Text>
|
|
116
|
+
</TouchableOpacity>
|
|
117
|
+
</View>);
|
|
118
|
+
case RefreshState.EmptyData:
|
|
119
|
+
if (props.renderListEmptyComponent)
|
|
120
|
+
return props.renderListEmptyComponent();
|
|
121
|
+
return (<View style={styles.container}>
|
|
122
|
+
<TouchableOpacity onPress={() => reload && reload()}>
|
|
123
|
+
<Text style={styles.text}>{RefreshText.EmptyData}</Text>
|
|
124
|
+
</TouchableOpacity>
|
|
125
|
+
</View>);
|
|
126
|
+
default:
|
|
127
|
+
return <View />;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
const ListHeaderComponent = React.memo((props) => {
|
|
131
|
+
const { refreshState } = props;
|
|
132
|
+
switch (refreshState) {
|
|
133
|
+
case RefreshState.HeaderRefreshing:
|
|
134
|
+
return (<View style={{ ...styles.container }}>
|
|
135
|
+
<Text style={{ ...styles.text }}>{RefreshText.HeaderRefreshing}</Text>
|
|
136
|
+
</View>);
|
|
137
|
+
default:
|
|
138
|
+
return <View />;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const styles = StyleSheet.create({
|
|
142
|
+
container: {
|
|
143
|
+
display: "flex",
|
|
144
|
+
flexDirection: "column",
|
|
145
|
+
justifyContent: "center",
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
height: 44,
|
|
148
|
+
// backgroundColor:'cyan'
|
|
149
|
+
},
|
|
150
|
+
text: {
|
|
151
|
+
color: "gray",
|
|
152
|
+
lineHeight: 16,
|
|
153
|
+
fontSize: 13,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextStyle } from "react-native";
|
|
3
|
+
export type RichTextProps = {
|
|
4
|
+
rich?: string | number;
|
|
5
|
+
richStyle?: TextStyle;
|
|
6
|
+
text?: string | number;
|
|
7
|
+
suffix?: boolean;
|
|
8
|
+
prefix?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: (props: RichTextProps) => React.JSX.Element;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=RichText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/RichText.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3D,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;yBACc,OAAO,aAAa;AAApC,wBA6CE"}
|