@arco-design/mobile-react 2.29.4 → 2.29.6
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/CHANGELOG.md +28 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/action-sheet/index.d.ts +2 -2
- package/cjs/dialog/index.d.ts +2 -2
- package/cjs/image/index.d.ts +7 -7
- package/cjs/image/index.js +81 -61
- package/cjs/image-picker/index.js +14 -6
- package/cjs/image-preview/index.d.ts +2 -2
- package/cjs/image-preview/index.js +11 -5
- package/cjs/image-preview/methods.d.ts +1 -0
- package/cjs/image-preview/methods.js +7 -2
- package/cjs/index.d.ts +5 -5
- package/cjs/index.js +16 -16
- package/cjs/load-more/index.d.ts +7 -2
- package/cjs/load-more/index.js +9 -1
- package/cjs/masking/index.d.ts +2 -2
- package/cjs/masking/methods.js +7 -2
- package/cjs/popup/index.d.ts +2 -2
- package/cjs/popup-swiper/index.d.ts +4 -10
- package/cjs/pull-refresh/android-pull-refresh.js +12 -20
- package/cjs/pull-refresh/hooks.js +2 -2
- package/cjs/pull-refresh/style/css/index.css +0 -1
- package/cjs/pull-refresh/style/index.less +0 -1
- package/cjs/style.d.ts +5 -5
- package/cjs/style.js +8 -8
- package/cjs/tabs/index.js +4 -1
- package/cjs/tabs/tab-pane.js +5 -2
- package/cjs/toast/index.d.ts +12 -12
- package/dist/index.js +2505 -2458
- package/dist/index.min.js +4 -4
- package/dist/style.css +503 -504
- package/dist/style.min.css +1 -1
- package/esm/action-sheet/index.d.ts +2 -2
- package/esm/dialog/index.d.ts +2 -2
- package/esm/image/index.d.ts +7 -7
- package/esm/image/index.js +81 -61
- package/esm/image-picker/index.js +13 -6
- package/esm/image-preview/index.d.ts +2 -2
- package/esm/image-preview/index.js +11 -5
- package/esm/image-preview/methods.d.ts +1 -0
- package/esm/image-preview/methods.js +7 -3
- package/esm/index.d.ts +5 -5
- package/esm/index.js +5 -5
- package/esm/load-more/index.d.ts +7 -2
- package/esm/load-more/index.js +9 -1
- package/esm/masking/index.d.ts +2 -2
- package/esm/masking/methods.js +7 -3
- package/esm/popup/index.d.ts +2 -2
- package/esm/popup-swiper/index.d.ts +4 -10
- package/esm/pull-refresh/android-pull-refresh.js +13 -22
- package/esm/pull-refresh/hooks.js +2 -2
- package/esm/pull-refresh/style/css/index.css +0 -1
- package/esm/pull-refresh/style/index.less +0 -1
- package/esm/style.d.ts +5 -5
- package/esm/style.js +5 -5
- package/esm/tabs/index.js +4 -1
- package/esm/tabs/tab-pane.js +6 -3
- package/esm/toast/index.d.ts +12 -12
- package/package.json +3 -3
- package/umd/action-sheet/index.d.ts +2 -2
- package/umd/dialog/index.d.ts +2 -2
- package/umd/image/index.d.ts +7 -7
- package/umd/image/index.js +81 -61
- package/umd/image-picker/index.js +16 -10
- package/umd/image-preview/index.d.ts +2 -2
- package/umd/image-preview/index.js +11 -5
- package/umd/image-preview/methods.d.ts +1 -0
- package/umd/image-preview/methods.js +7 -2
- package/umd/index.d.ts +5 -5
- package/umd/index.js +14 -14
- package/umd/load-more/index.d.ts +7 -2
- package/umd/load-more/index.js +9 -1
- package/umd/masking/index.d.ts +2 -2
- package/umd/masking/methods.js +7 -2
- package/umd/popup/index.d.ts +2 -2
- package/umd/popup-swiper/index.d.ts +4 -10
- package/umd/pull-refresh/android-pull-refresh.js +15 -24
- package/umd/pull-refresh/hooks.js +2 -2
- package/umd/pull-refresh/style/css/index.css +0 -1
- package/umd/pull-refresh/style/index.less +0 -1
- package/umd/style.d.ts +5 -5
- package/umd/style.js +2 -2
- package/umd/tabs/index.js +4 -1
- package/umd/tabs/tab-pane.js +5 -2
- package/umd/toast/index.d.ts +12 -12
@@ -1,10 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import React, { useRef, forwardRef, useCallback, useMemo, useContext, useEffect, useImperativeHandle } from 'react';
|
2
3
|
import { cls, nextTick, defaultLocale } from '@arco-design/mobile-utils';
|
3
4
|
import Loading from '../loading';
|
4
5
|
import { GlobalContext } from '../context-provider';
|
5
6
|
import { PullRefreshStatus } from './model';
|
6
7
|
import { useCommonState, useAddScrollEvents, useCheckAsStart } from './hooks';
|
7
|
-
import {
|
8
|
+
import { setStyleWithVendor } from '../_helpers';
|
8
9
|
|
9
10
|
var dampRateCalculate = function dampRateCalculate(val, tipsHeight, dampRate) {
|
10
11
|
return val > tipsHeight ? tipsHeight + (val - tipsHeight) / dampRate : val;
|
@@ -53,11 +54,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
54
|
onRefresh = props.onRefresh,
|
54
55
|
_props$allowPullWhenN = props.allowPullWhenNotTop,
|
55
56
|
allowPullWhenNotTop = _props$allowPullWhenN === void 0 ? false : _props$allowPullWhenN;
|
56
|
-
|
57
|
-
var _useState = useState({}),
|
58
|
-
transition = _useState[0],
|
59
|
-
setTransition = _useState[1];
|
60
|
-
|
57
|
+
var placeRef = useRef(null);
|
61
58
|
var touchRef = useRef(null);
|
62
59
|
var currentTranslateYRef = useRef(0);
|
63
60
|
var onTouching = useRef(false);
|
@@ -94,17 +91,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
91
|
|
95
92
|
var scroll = function scroll(y, ms, callback) {
|
96
93
|
if (y < 5) {
|
97
|
-
if (y < 0) {
|
98
|
-
currentTranslateYRef.current = 0;
|
99
|
-
return;
|
100
|
-
}
|
101
|
-
|
102
|
-
if (ms === 0) {
|
103
|
-
setTimeout(function () {
|
104
|
-
setTransition({
|
105
|
-
transition: 'all 0s'
|
106
|
-
});
|
107
|
-
});
|
94
|
+
if (y < 0 || ms === 0) {
|
108
95
|
currentTranslateYRef.current = 0;
|
109
96
|
return;
|
110
97
|
}
|
@@ -112,10 +99,11 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
112
99
|
|
113
100
|
var translateY = dampRateCalculate(y, loosingHeight, dampRate);
|
114
101
|
currentTranslateYRef.current = translateY;
|
115
|
-
|
116
|
-
transform: translateY ? "translateY(" + translateY + "px)" : ''
|
102
|
+
placeRef.current && setStyleWithVendor(placeRef.current, _extends({
|
103
|
+
transform: translateY ? "translateY(" + translateY + "px) translateZ(0)" : ''
|
104
|
+
}, ms ? {
|
117
105
|
transition: "all " + ms / 1000 + "s"
|
118
|
-
});
|
106
|
+
} : {}));
|
119
107
|
setTimeout(function () {
|
120
108
|
callback == null ? void 0 : callback();
|
121
109
|
}, ms);
|
@@ -133,6 +121,9 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
133
121
|
|
134
122
|
loadingRef.current = false;
|
135
123
|
setStatus(PullRefreshStatus.Static);
|
124
|
+
placeRef.current && setStyleWithVendor(placeRef.current, {
|
125
|
+
transition: ''
|
126
|
+
});
|
136
127
|
callback();
|
137
128
|
});
|
138
129
|
};
|
@@ -260,7 +251,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
260
251
|
ref: domRef
|
261
252
|
}, /*#__PURE__*/React.createElement("div", {
|
262
253
|
className: cls(prefixCls + "-pull-refresh-place"),
|
263
|
-
|
254
|
+
ref: placeRef
|
264
255
|
}, /*#__PURE__*/React.createElement("div", {
|
265
256
|
className: cls(prefixCls + "-pull-refresh-label"),
|
266
257
|
ref: labelRef,
|
@@ -96,9 +96,9 @@ export var useCheckAsStart = function useCheckAsStart(_ref3) {
|
|
96
96
|
var allowPullWhenNotTop = _ref3.allowPullWhenNotTop,
|
97
97
|
domRef = _ref3.domRef;
|
98
98
|
var ifShouldHandle = useCallback(function () {
|
99
|
-
var _domRef$current$
|
99
|
+
var _domRef$current$offse, _domRef$current9;
|
100
100
|
|
101
|
-
var domRefHeight = (_domRef$current$
|
101
|
+
var domRefHeight = (_domRef$current$offse = (_domRef$current9 = domRef.current) == null ? void 0 : _domRef$current9.offsetHeight) != null ? _domRef$current$offse : 0;
|
102
102
|
return domRef.current && !(!allowPullWhenNotTop && (domRef.current.scrollTop < 0 || domRef.current.scrollTop > domRef.current.scrollHeight - domRefHeight));
|
103
103
|
}, [allowPullWhenNotTop]);
|
104
104
|
return {
|
package/esm/style.d.ts
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
import '../style/public.less';
|
2
2
|
import './tabs/style';
|
3
3
|
import './sticky/style';
|
4
|
-
import './
|
5
|
-
import './
|
4
|
+
import './portal/style';
|
5
|
+
import './toast/style';
|
6
6
|
import './action-sheet/style';
|
7
7
|
import './avatar/style';
|
8
8
|
import './badge/style';
|
9
9
|
import './button/style';
|
10
10
|
import './carousel/style';
|
11
|
+
import './cell/style';
|
11
12
|
import './checkbox/style';
|
12
13
|
import './circle-progress/style';
|
13
14
|
import './collapse/style';
|
@@ -27,6 +28,7 @@ import './image-preview/style';
|
|
27
28
|
import './index-bar/style';
|
28
29
|
import './input/style';
|
29
30
|
import './keyboard/style';
|
31
|
+
import './load-more/style';
|
30
32
|
import './loading/style';
|
31
33
|
import './masking/style';
|
32
34
|
import './nav-bar/style';
|
@@ -38,14 +40,13 @@ import './picker-view/style';
|
|
38
40
|
import './popover/style';
|
39
41
|
import './popup/style';
|
40
42
|
import './popup-swiper/style';
|
41
|
-
import './portal/style';
|
42
43
|
import './progress/style';
|
43
44
|
import './pull-refresh/style';
|
44
45
|
import './radio/style';
|
45
46
|
import './rate/style';
|
46
47
|
import './search-bar/style';
|
47
|
-
import './skeleton/style';
|
48
48
|
import './show-monitor/style';
|
49
|
+
import './skeleton/style';
|
49
50
|
import './slider/style';
|
50
51
|
import './stepper/style';
|
51
52
|
import './steps/style';
|
@@ -55,5 +56,4 @@ import './switch/style';
|
|
55
56
|
import './tab-bar/style';
|
56
57
|
import './tag/style';
|
57
58
|
import './textarea/style';
|
58
|
-
import './toast/style';
|
59
59
|
import './transition/style';
|
package/esm/style.js
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
import '../style/public.less';
|
2
2
|
import './tabs/style';
|
3
3
|
import './sticky/style';
|
4
|
-
import './
|
5
|
-
import './
|
4
|
+
import './portal/style';
|
5
|
+
import './toast/style';
|
6
6
|
import './action-sheet/style';
|
7
7
|
import './avatar/style';
|
8
8
|
import './badge/style';
|
9
9
|
import './button/style';
|
10
10
|
import './carousel/style';
|
11
|
+
import './cell/style';
|
11
12
|
import './checkbox/style';
|
12
13
|
import './circle-progress/style';
|
13
14
|
import './collapse/style';
|
@@ -27,6 +28,7 @@ import './image-preview/style';
|
|
27
28
|
import './index-bar/style';
|
28
29
|
import './input/style';
|
29
30
|
import './keyboard/style';
|
31
|
+
import './load-more/style';
|
30
32
|
import './loading/style';
|
31
33
|
import './masking/style';
|
32
34
|
import './nav-bar/style';
|
@@ -38,14 +40,13 @@ import './picker-view/style';
|
|
38
40
|
import './popover/style';
|
39
41
|
import './popup/style';
|
40
42
|
import './popup-swiper/style';
|
41
|
-
import './portal/style';
|
42
43
|
import './progress/style';
|
43
44
|
import './pull-refresh/style';
|
44
45
|
import './radio/style';
|
45
46
|
import './rate/style';
|
46
47
|
import './search-bar/style';
|
47
|
-
import './skeleton/style';
|
48
48
|
import './show-monitor/style';
|
49
|
+
import './skeleton/style';
|
49
50
|
import './slider/style';
|
50
51
|
import './stepper/style';
|
51
52
|
import './steps/style';
|
@@ -55,5 +56,4 @@ import './switch/style';
|
|
55
56
|
import './tab-bar/style';
|
56
57
|
import './tag/style';
|
57
58
|
import './textarea/style';
|
58
|
-
import './toast/style';
|
59
59
|
import './transition/style';
|
package/esm/tabs/index.js
CHANGED
@@ -229,7 +229,10 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
229
229
|
// 利用受控手动更改index时,给cell line加上动画
|
230
230
|
// @en Animate the cell line when changeing the index
|
231
231
|
setCellTrans(true);
|
232
|
-
|
232
|
+
|
233
|
+
if (!changeFromRef.current) {
|
234
|
+
changeFromRef.current = 'manual';
|
235
|
+
}
|
233
236
|
}, [activeTab]);
|
234
237
|
useUpdateEffect(function () {
|
235
238
|
onDistanceChange && onDistanceChange(distance, wrapWidth, activeIndex);
|
package/esm/tabs/tab-pane.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useMemo } from 'react';
|
3
3
|
import lodashThrottle from 'lodash.throttle';
|
4
|
-
import { cls, scrollWithAnimation, getScrollContainerRect } from '@arco-design/mobile-utils';
|
4
|
+
import { cls, scrollWithAnimation, getScrollContainerRect, isSSR } from '@arco-design/mobile-utils';
|
5
5
|
import { getStyleWithVendor } from '../_helpers';
|
6
6
|
var TabPane = /*#__PURE__*/forwardRef(function (props, ref) {
|
7
7
|
var _cls;
|
@@ -234,12 +234,15 @@ var TabPane = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
234
234
|
}
|
235
235
|
|
236
236
|
var translateStr = translateZ ? ' translateZ(0)' : '';
|
237
|
+
var translatePercentInSSR = (panes.length ? 100 / panes.length : 0) * activeIndex * rtlRatio * -1 + "%";
|
238
|
+
var verticalTranslate = distance - wrapWidth * activeIndex * rtlRatio + "px";
|
239
|
+
var horizontalTranslate = distance - wrapHeight * activeIndex + "px";
|
237
240
|
var sizeStyle = tabDirection === 'vertical' ? {
|
238
241
|
width: 100 * panes.length + "%",
|
239
|
-
transform: "translateX(" + (
|
242
|
+
transform: "translateX(" + (isSSR() ? translatePercentInSSR : verticalTranslate) + ")" + translateStr
|
240
243
|
} : {
|
241
244
|
height: 100 * panes.length + "%",
|
242
|
-
transform: "translateY(" + (
|
245
|
+
transform: "translateY(" + (isSSR() ? translatePercentInSSR : horizontalTranslate) + ")" + translateStr
|
243
246
|
};
|
244
247
|
var heightStyle = currentPaneHeight && currentPaneHeight !== 'auto' ? {
|
245
248
|
height: currentPaneHeight
|
package/esm/toast/index.d.ts
CHANGED
@@ -185,8 +185,8 @@ declare const _default: React.ForwardRefExoticComponent<ToastProps & React.RefAt
|
|
185
185
|
* @param {string | ToastProps} config Configuration
|
186
186
|
* @returns {{ update: (config: ToastProps) => void; close: () => void }}
|
187
187
|
*/
|
188
|
-
toast: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
189
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
188
|
+
toast: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
189
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">) => void;
|
190
190
|
close: () => void;
|
191
191
|
hide: () => void;
|
192
192
|
};
|
@@ -196,8 +196,8 @@ declare const _default: React.ForwardRefExoticComponent<ToastProps & React.RefAt
|
|
196
196
|
* @param {string | ToastProps} config Configuration
|
197
197
|
* @returns {{ update: (config: ToastProps) => void; close: () => void }}
|
198
198
|
*/
|
199
|
-
info: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
200
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
199
|
+
info: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
200
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">) => void;
|
201
201
|
close: () => void;
|
202
202
|
hide: () => void;
|
203
203
|
};
|
@@ -207,8 +207,8 @@ declare const _default: React.ForwardRefExoticComponent<ToastProps & React.RefAt
|
|
207
207
|
* @param {string | ToastProps} config Configuration
|
208
208
|
* @returns {{ update: (config: ToastProps) => void; close: () => void }}
|
209
209
|
*/
|
210
|
-
success: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
211
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
210
|
+
success: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
211
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">) => void;
|
212
212
|
close: () => void;
|
213
213
|
hide: () => void;
|
214
214
|
};
|
@@ -218,8 +218,8 @@ declare const _default: React.ForwardRefExoticComponent<ToastProps & React.RefAt
|
|
218
218
|
* @param {string | ToastProps} config Configuration
|
219
219
|
* @returns {{ update: (config: ToastProps) => void; close: () => void }}
|
220
220
|
*/
|
221
|
-
error: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
222
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
221
|
+
error: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
222
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">) => void;
|
223
223
|
close: () => void;
|
224
224
|
hide: () => void;
|
225
225
|
};
|
@@ -229,8 +229,8 @@ declare const _default: React.ForwardRefExoticComponent<ToastProps & React.RefAt
|
|
229
229
|
* @param {string | ToastProps} config Configuration
|
230
230
|
* @returns {{ update: (config: ToastProps) => void; close: () => void }}
|
231
231
|
*/
|
232
|
-
loading: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
233
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
232
|
+
loading: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
233
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">) => void;
|
234
234
|
close: () => void;
|
235
235
|
hide: () => void;
|
236
236
|
};
|
@@ -240,8 +240,8 @@ declare const _default: React.ForwardRefExoticComponent<ToastProps & React.RefAt
|
|
240
240
|
* @param {string | ToastProps} config Configuration
|
241
241
|
* @returns {{ update: (config: ToastProps) => void; close: () => void }}
|
242
242
|
*/
|
243
|
-
warn: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
244
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "
|
243
|
+
warn: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
244
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ToastProps & React.RefAttributes<ToastRef>>, "loading" | "content" | "layout" | "icon" | "direction" | "transitionDuration" | "ref" | "key" | "type" | "context" | "duration" | "className" | "getContainer" | "onClose" | "loadingIcon" | "loadingInner" | "disableBodyTouch" | "typeIconMap" | "initialBodyOverflow">) => void;
|
245
245
|
close: () => void;
|
246
246
|
hide: () => void;
|
247
247
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arco-design/mobile-react",
|
3
|
-
"version": "2.29.
|
3
|
+
"version": "2.29.6",
|
4
4
|
"description": "",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "esm/index.js",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"author": "taoyiyue@bytedance.com",
|
16
16
|
"license": "ISC",
|
17
17
|
"dependencies": {
|
18
|
-
"@arco-design/mobile-utils": "2.16.
|
18
|
+
"@arco-design/mobile-utils": "2.16.9",
|
19
19
|
"@arco-design/transformable": "^1.0.0",
|
20
20
|
"lodash.throttle": "^4.1.1",
|
21
21
|
"resize-observer-polyfill": "^1.5.1"
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"publishConfig": {
|
50
50
|
"access": "public"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "0ac7a2b2a9f339e75d0b81d6af6dcf0f55ffad45"
|
53
53
|
}
|
@@ -86,11 +86,11 @@ declare const _default: React.ForwardRefExoticComponent<ActionSheetProps & React
|
|
86
86
|
* @param {ActionSheetProps} config setting
|
87
87
|
* @returns {{ close: () => void; update: (newConfig: ActionSheetProps) => void; }}
|
88
88
|
*/
|
89
|
-
open: (config: Pick<import("../context-provider").WithGlobalContext<ActionSheetProps & React.RefAttributes<ActionSheetRef>>, "title" | "ref" | "key" | "context" | "translateZ" | "className" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "preventBodyScroll" | "
|
89
|
+
open: (config: Pick<import("../context-provider").WithGlobalContext<ActionSheetProps & React.RefAttributes<ActionSheetRef>>, "title" | "ref" | "key" | "context" | "translateZ" | "className" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset" | "items" | "cancelText" | "subTitle"> & {
|
90
90
|
key?: string | undefined;
|
91
91
|
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
92
92
|
close: () => void;
|
93
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ActionSheetProps & React.RefAttributes<ActionSheetRef>>, "title" | "ref" | "key" | "context" | "translateZ" | "className" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "preventBodyScroll" | "
|
93
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ActionSheetProps & React.RefAttributes<ActionSheetRef>>, "title" | "ref" | "key" | "context" | "translateZ" | "className" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset" | "items" | "cancelText" | "subTitle"> & {
|
94
94
|
key?: string | undefined;
|
95
95
|
}) => void;
|
96
96
|
};
|
package/umd/dialog/index.d.ts
CHANGED
@@ -193,11 +193,11 @@ declare const _default: React.ForwardRefExoticComponent<DialogProps & React.RefA
|
|
193
193
|
* @param {DialogProps} config Configuration
|
194
194
|
* @returns {{ close: () => void; update: (newConfig: DialogProps) => void; }}
|
195
195
|
*/
|
196
|
-
open: (config: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "
|
196
|
+
open: (config: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
|
197
197
|
key?: string | undefined;
|
198
198
|
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
199
199
|
close: () => void;
|
200
|
-
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "
|
200
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
|
201
201
|
key?: string | undefined;
|
202
202
|
}) => void;
|
203
203
|
};
|
package/umd/image/index.d.ts
CHANGED
@@ -60,22 +60,22 @@ export interface ImageProps {
|
|
60
60
|
* */
|
61
61
|
bordered?: boolean;
|
62
62
|
/**
|
63
|
-
*
|
63
|
+
* 自定义展示加载中内容
|
64
64
|
* @en Custom display loading content, valid when staticLabel=false
|
65
65
|
* */
|
66
66
|
loadingArea?: ReactNode;
|
67
67
|
/**
|
68
|
-
*
|
68
|
+
* 自定义展示加载失败内容
|
69
69
|
* @en Custom display failed to load content, valid when staticLabel=false
|
70
70
|
* */
|
71
71
|
errorArea?: ReactNode;
|
72
72
|
/**
|
73
|
-
*
|
73
|
+
* 是否展示图片加载中提示
|
74
74
|
* @en Whether to display the image loading prompt, valid when staticLabel=false
|
75
75
|
* */
|
76
76
|
showLoading?: boolean;
|
77
77
|
/**
|
78
|
-
*
|
78
|
+
* 是否展示图片加载失败提示
|
79
79
|
* @en Whether to display the image loading failure prompt, valid when staticLabel=false
|
80
80
|
* */
|
81
81
|
showError?: boolean;
|
@@ -145,17 +145,17 @@ export interface ImageProps {
|
|
145
145
|
* 图片加载完毕时触发的回调
|
146
146
|
* @en Callback when the image is loaded
|
147
147
|
* */
|
148
|
-
onLoad?: (e: Event, image: HTMLImageElement) => void;
|
148
|
+
onLoad?: (e: Event | null, image: HTMLImageElement) => void;
|
149
149
|
/**
|
150
150
|
* 图片加载失败时触发的回调,如果有自动重试则在重试最终失败后触发
|
151
151
|
* @en Callback when the image fails to load, triggered after the retry finally fails if there is an automatic retry
|
152
152
|
*/
|
153
|
-
onError?: (e: string | Event) => void;
|
153
|
+
onError?: (e: string | Event | null) => void;
|
154
154
|
/**
|
155
155
|
* 图片加载失败时自动重试触发的回调
|
156
156
|
* @en Callback triggered by automatic retry when image loading fails
|
157
157
|
*/
|
158
|
-
onAutoRetry?: (e: string | Event) => void;
|
158
|
+
onAutoRetry?: (e: string | Event | null) => void;
|
159
159
|
}
|
160
160
|
export interface ImageRef {
|
161
161
|
/**
|
package/umd/image/index.js
CHANGED
@@ -34,30 +34,6 @@
|
|
34
34
|
* @name_en Image
|
35
35
|
*/
|
36
36
|
var BaseImage = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
37
|
-
var system = (0, _helpers.useSystem)();
|
38
|
-
|
39
|
-
var _useWindowSize = (0, _helpers.useWindowSize)(),
|
40
|
-
windowWidth = _useWindowSize.windowWidth,
|
41
|
-
windowHeight = _useWindowSize.windowHeight;
|
42
|
-
|
43
|
-
var _useMountedState = (0, _helpers.useMountedState)('init'),
|
44
|
-
imageStatus = _useMountedState[0],
|
45
|
-
setImageStatus = _useMountedState[1];
|
46
|
-
|
47
|
-
var _useMountedState2 = (0, _helpers.useMountedState)(''),
|
48
|
-
wrapClass = _useMountedState2[0],
|
49
|
-
setWrapClass = _useMountedState2[1];
|
50
|
-
|
51
|
-
var _useMountedState3 = (0, _helpers.useMountedState)(false),
|
52
|
-
staticRetrying = _useMountedState3[0],
|
53
|
-
setStaticRetrying = _useMountedState3[1];
|
54
|
-
|
55
|
-
var imageRef = (0, _react.useRef)(null);
|
56
|
-
var imageDomRef = (0, _react.useRef)(null);
|
57
|
-
var wrapRef = (0, _react.useRef)(null);
|
58
|
-
var retryCountRef = (0, _react.useRef)(0);
|
59
|
-
var loadingImageRef = (0, _react.useRef)(null);
|
60
|
-
var hasLoadedRef = (0, _react.useRef)(false);
|
61
37
|
var style = props.style,
|
62
38
|
className = props.className,
|
63
39
|
status = props.status,
|
@@ -94,9 +70,33 @@
|
|
94
70
|
nativeProps = _props$nativeProps === void 0 ? {} : _props$nativeProps,
|
95
71
|
onChange = props.onChange,
|
96
72
|
onClick = props.onClick,
|
97
|
-
|
73
|
+
onLoad = props.onLoad,
|
98
74
|
onError = props.onError,
|
99
75
|
onAutoRetry = props.onAutoRetry;
|
76
|
+
var system = (0, _helpers.useSystem)();
|
77
|
+
|
78
|
+
var _useWindowSize = (0, _helpers.useWindowSize)(),
|
79
|
+
windowWidth = _useWindowSize.windowWidth,
|
80
|
+
windowHeight = _useWindowSize.windowHeight;
|
81
|
+
|
82
|
+
var _useMountedState = (0, _helpers.useMountedState)(staticLabel && showLoading ? 'loading' : 'init'),
|
83
|
+
imageStatus = _useMountedState[0],
|
84
|
+
setImageStatus = _useMountedState[1];
|
85
|
+
|
86
|
+
var _useMountedState2 = (0, _helpers.useMountedState)(''),
|
87
|
+
wrapClass = _useMountedState2[0],
|
88
|
+
setWrapClass = _useMountedState2[1];
|
89
|
+
|
90
|
+
var _useMountedState3 = (0, _helpers.useMountedState)(false),
|
91
|
+
staticRetrying = _useMountedState3[0],
|
92
|
+
setStaticRetrying = _useMountedState3[1];
|
93
|
+
|
94
|
+
var imageRef = (0, _react.useRef)(null);
|
95
|
+
var imageDomRef = (0, _react.useRef)(null);
|
96
|
+
var wrapRef = (0, _react.useRef)(null);
|
97
|
+
var retryCountRef = (0, _react.useRef)(0);
|
98
|
+
var loadingImageRef = (0, _react.useRef)(null);
|
99
|
+
var hasLoadedRef = (0, _react.useRef)(false);
|
100
100
|
var isPreview = Boolean(fit.indexOf('preview') >= 0);
|
101
101
|
var actualBoxWidth = boxWidth || windowWidth;
|
102
102
|
var actualBoxHeight = boxHeight || windowHeight;
|
@@ -132,6 +132,21 @@
|
|
132
132
|
retryCountRef.current = 0;
|
133
133
|
loadImage();
|
134
134
|
}, [attrs, width, height, showImage, staticLabel]);
|
135
|
+
(0, _react.useEffect)(function () {
|
136
|
+
var _imageDomRef$current;
|
137
|
+
|
138
|
+
// 当使用img标签时,onLoad可能加载完成前已经执行完,此时手动触发一次
|
139
|
+
// @en When using the img tag, onLoad may have been executed before loading is complete, and it needs to be triggered manually
|
140
|
+
if (staticLabel && !hasLoadedRef.current && (_imageDomRef$current = imageDomRef.current) != null && _imageDomRef$current.complete) {
|
141
|
+
// 图片有宽高认为正常加载,否则认为加载错误
|
142
|
+
// @en If the image has width and height, it is considered to be loaded normally, otherwise it is considered to be a loading error
|
143
|
+
if (imageDomRef.current.naturalWidth || imageDomRef.current.naturalHeight) {
|
144
|
+
handleImageLoaded(null, imageDomRef.current);
|
145
|
+
} else {
|
146
|
+
handleStaticImageError(null);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}, [staticLabel]);
|
135
150
|
|
136
151
|
function changeStatus(newStatus) {
|
137
152
|
setImageStatus(newStatus);
|
@@ -152,6 +167,43 @@
|
|
152
167
|
}
|
153
168
|
}
|
154
169
|
|
170
|
+
function handleImageLoaded(evt, image) {
|
171
|
+
hasLoadedRef.current = true;
|
172
|
+
changeStatus('loaded');
|
173
|
+
var _image$width = image.width,
|
174
|
+
imageWidth = _image$width === void 0 ? 0 : _image$width,
|
175
|
+
_image$height = image.height,
|
176
|
+
imageHeight = _image$height === void 0 ? 0 : _image$height;
|
177
|
+
var extraClass = '';
|
178
|
+
|
179
|
+
if (isPreview) {
|
180
|
+
var scale = imageWidth / imageHeight;
|
181
|
+
var windowScale = actualBoxWidth / actualBoxHeight;
|
182
|
+
|
183
|
+
if (fit === 'preview-y') {
|
184
|
+
if (scale < windowScale) {
|
185
|
+
image.style.width = actualBoxWidth + "px";
|
186
|
+
image.style.height = actualBoxWidth / scale + "px";
|
187
|
+
extraClass = 'preview-overflow-y';
|
188
|
+
} else {
|
189
|
+
extraClass = 'preview-fit-contain-y';
|
190
|
+
}
|
191
|
+
} else if (fit === 'preview-x') {
|
192
|
+
if (scale > windowScale) {
|
193
|
+
image.style.width = actualBoxHeight * scale + "px";
|
194
|
+
image.style.height = actualBoxHeight + "px";
|
195
|
+
extraClass = 'preview-overflow-x';
|
196
|
+
} else {
|
197
|
+
extraClass = 'preview-fit-contain-x';
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
extraClass && image.classList.add(extraClass);
|
203
|
+
setWrapClass(extraClass ? extraClass + "-container" : '');
|
204
|
+
onLoad && onLoad(evt, image);
|
205
|
+
}
|
206
|
+
|
155
207
|
function loadImage(isFromRetry) {
|
156
208
|
// 如果在加载图片前发现上一个图片还没加载完,则抛弃上一个图片的加载
|
157
209
|
// @en Abort last image before starting loading new image
|
@@ -177,41 +229,8 @@
|
|
177
229
|
image.onload = function (evt) {
|
178
230
|
loadingImageRef.current = null;
|
179
231
|
imageDomRef.current = image;
|
180
|
-
|
181
|
-
changeStatus('loaded');
|
182
|
-
var _image$width = image.width,
|
183
|
-
imageWidth = _image$width === void 0 ? 0 : _image$width,
|
184
|
-
_image$height = image.height,
|
185
|
-
imageHeight = _image$height === void 0 ? 0 : _image$height;
|
186
|
-
var extraClass = '';
|
187
|
-
|
188
|
-
if (isPreview) {
|
189
|
-
var scale = imageWidth / imageHeight;
|
190
|
-
var windowScale = actualBoxWidth / actualBoxHeight;
|
191
|
-
|
192
|
-
if (fit === 'preview-y') {
|
193
|
-
if (scale < windowScale) {
|
194
|
-
image.style.width = actualBoxWidth + "px";
|
195
|
-
image.style.height = actualBoxWidth / scale + "px";
|
196
|
-
extraClass = 'preview-overflow-y';
|
197
|
-
} else {
|
198
|
-
extraClass = 'preview-fit-contain-y';
|
199
|
-
}
|
200
|
-
} else if (fit === 'preview-x') {
|
201
|
-
if (scale > windowScale) {
|
202
|
-
image.style.width = actualBoxHeight * scale + "px";
|
203
|
-
image.style.height = actualBoxHeight + "px";
|
204
|
-
extraClass = 'preview-overflow-x';
|
205
|
-
} else {
|
206
|
-
extraClass = 'preview-fit-contain-x';
|
207
|
-
}
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
extraClass && image.classList.add(extraClass);
|
212
|
-
setWrapClass(extraClass ? extraClass + "-container" : '');
|
232
|
+
handleImageLoaded(evt, image);
|
213
233
|
replaceChild(image);
|
214
|
-
_onLoad && _onLoad(evt, image);
|
215
234
|
};
|
216
235
|
|
217
236
|
image.onerror = function (evt) {
|
@@ -237,9 +256,10 @@
|
|
237
256
|
}
|
238
257
|
|
239
258
|
function handleStaticImageError(e) {
|
240
|
-
var evt = e.nativeEvent;
|
259
|
+
var evt = e ? e.nativeEvent : null;
|
241
260
|
|
242
261
|
if (retryCountRef.current >= retryTime) {
|
262
|
+
changeStatus('error');
|
243
263
|
onError && onError(evt);
|
244
264
|
} else {
|
245
265
|
retryCountRef.current += 1;
|
@@ -304,7 +324,7 @@
|
|
304
324
|
}, staticLabel && showImage && !staticRetrying ? /*#__PURE__*/_react.default.createElement("img", (0, _extends2.default)({}, nativeProps, attrs, {
|
305
325
|
ref: imageDomRef,
|
306
326
|
onLoad: function onLoad(e) {
|
307
|
-
return
|
327
|
+
return handleImageLoaded(e.nativeEvent, imageDomRef.current);
|
308
328
|
},
|
309
329
|
onError: handleStaticImageError
|
310
330
|
})) : null), showLoading && validStatus === 'loading' ? /*#__PURE__*/_react.default.createElement("div", {
|