@arco-design/mobile-react 2.33.0 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.js +2 -0
  5. package/cjs/date-picker/index.js +1 -1
  6. package/cjs/date-picker/type.d.ts +1 -1
  7. package/cjs/divider/style/css/index.css +6 -4
  8. package/cjs/divider/style/index.less +3 -1
  9. package/cjs/notice-bar/index.js +11 -8
  10. package/cjs/popover/popover-inner.js +9 -2
  11. package/dist/index.js +23 -11
  12. package/dist/index.min.js +2 -2
  13. package/dist/style.css +5 -3
  14. package/dist/style.min.css +1 -1
  15. package/esm/_helpers/hooks.js +2 -0
  16. package/esm/date-picker/index.js +2 -2
  17. package/esm/date-picker/type.d.ts +1 -1
  18. package/esm/divider/style/css/index.css +6 -4
  19. package/esm/divider/style/index.less +3 -1
  20. package/esm/notice-bar/index.js +12 -9
  21. package/esm/popover/popover-inner.js +9 -2
  22. package/esnext/_helpers/hooks.js +6 -2
  23. package/esnext/date-picker/index.js +2 -2
  24. package/esnext/date-picker/type.d.ts +1 -1
  25. package/esnext/divider/style/css/index.css +6 -4
  26. package/esnext/divider/style/index.less +3 -1
  27. package/esnext/notice-bar/index.js +6 -6
  28. package/esnext/popover/popover-inner.js +7 -2
  29. package/package.json +3 -3
  30. package/tokens/app/arcodesign/default/css-variables.less +2 -1
  31. package/tokens/app/arcodesign/default/index.d.ts +1 -0
  32. package/tokens/app/arcodesign/default/index.js +2 -1
  33. package/tokens/app/arcodesign/default/index.json +15 -2
  34. package/tokens/app/arcodesign/default/index.less +2 -1
  35. package/umd/_helpers/hooks.js +2 -0
  36. package/umd/date-picker/index.js +1 -1
  37. package/umd/date-picker/type.d.ts +1 -1
  38. package/umd/divider/style/css/index.css +6 -4
  39. package/umd/divider/style/index.less +3 -1
  40. package/umd/notice-bar/index.js +11 -8
  41. package/umd/popover/popover-inner.js +9 -2
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC", "renderLinkedContainer"];
4
4
  import React, { useEffect, useRef, useState, useMemo, forwardRef, useImperativeHandle } from 'react';
5
- import { cls, componentWrapper, formatDateNumber } from '@arco-design/mobile-utils';
5
+ import { cls, componentWrapper, formatDateNumber, isEmptyValue } from '@arco-design/mobile-utils';
6
6
  import Picker from '../picker';
7
7
  import { ContextLayout } from '../context-provider';
8
8
  import { convertTsToDateObj, oneOf, judgeObj, convertObjToTs } from './helper';
@@ -317,7 +317,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
317
317
  onOk: _handlePickerConfirm,
318
318
  touchToStop: touchToStop,
319
319
  renderLinkedContainer: renderLinkedContainer ? function () {
320
- return renderLinkedContainer(currentTs, keyOptions);
320
+ return renderLinkedContainer(isEmptyValue(props.currentTs) ? undefined : currentTs, keyOptions);
321
321
  } : undefined
322
322
  }));
323
323
  });
@@ -110,5 +110,5 @@ export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' |
110
110
  * 将选择器的展现隐藏状态及选中值的展示与某个容器关联,传入后将同时渲染该容器和选择器组件,此时选择器组件的 visible 和 onHide 属性可不传,点击该容器会唤起选择器
111
111
  * @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
112
112
  */
113
- renderLinkedContainer?: (currentTs: number, itemTypes: ItemType[]) => ReactNode;
113
+ renderLinkedContainer?: (currentTs: number | undefined, itemTypes: ItemType[]) => ReactNode;
114
114
  }
@@ -542,10 +542,12 @@
542
542
  .arco-divider::before {
543
543
  content: '';
544
544
  }
545
- .arco-divider--hairline::before,
546
- .arco-divider--hairline::after {
547
- -webkit-transform: scaleY(0.5);
548
- transform: scaleY(0.5);
545
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
546
+ .arco-divider--hairline::before,
547
+ .arco-divider--hairline::after {
548
+ -webkit-transform: scaleY(0.5);
549
+ transform: scaleY(0.5);
550
+ }
549
551
  }
550
552
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
551
553
  .arco-divider--hairline::before,
@@ -27,7 +27,9 @@
27
27
  &--hairline {
28
28
  &::before,
29
29
  &::after {
30
- transform: scaleY(0.5);
30
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
31
+ transform: scaleY(0.5);
32
+ }
31
33
 
32
34
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
33
35
  transform: scaleY(0.33333333);
@@ -1,4 +1,4 @@
1
- import { cls, removeElement, fadeColor, nextTick } from '@arco-design/mobile-utils';
1
+ import { cls, fadeColor, nextTick } from '@arco-design/mobile-utils';
2
2
  import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useMemo, useContext } from 'react';
3
3
  import { ContextLayout, GlobalContext } from '../context-provider';
4
4
  import IconClose from '../icon/IconClose';
@@ -43,9 +43,13 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
43
43
  var contentRef = useRef(null);
44
44
  var timerRef = useRef(null);
45
45
 
46
- var _useState = useState(false),
47
- needMarquee = _useState[0],
48
- setNeedMarquee = _useState[1];
46
+ var _useState = useState(true),
47
+ visible = _useState[0],
48
+ setVisible = _useState[1];
49
+
50
+ var _useState2 = useState(false),
51
+ needMarquee = _useState2[0],
52
+ setNeedMarquee = _useState2[1];
49
53
 
50
54
  var extraClass = useMemo(function () {
51
55
  var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
@@ -86,9 +90,8 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
86
90
  }, [useRtl]);
87
91
 
88
92
  function close() {
89
- if (domRef.current) {
90
- removeElement(domRef.current);
91
- }
93
+ setVisible(false);
94
+ clear();
92
95
  }
93
96
 
94
97
  function handleClose(e) {
@@ -153,7 +156,7 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
153
156
  }
154
157
 
155
158
  function renderNoticeBar(prefix) {
156
- return /*#__PURE__*/React.createElement("div", {
159
+ return visible ? /*#__PURE__*/React.createElement("div", {
157
160
  className: cls(prefix, className, extraClass),
158
161
  style: style,
159
162
  ref: domRef,
@@ -179,7 +182,7 @@ var NoticeBar = /*#__PURE__*/forwardRef(function (props, ref) {
179
182
  }, rightContent) : null, closeable ? /*#__PURE__*/React.createElement("div", {
180
183
  className: prefix + "-close",
181
184
  onClick: handleClose
182
- }, closeIcon) : null);
185
+ }, closeIcon) : null) : null;
183
186
  }
184
187
 
185
188
  return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
@@ -47,7 +47,15 @@ export var PopoverInner = /*#__PURE__*/forwardRef(function (props, ref) {
47
47
  if (left || width || top || height || bottom) {
48
48
  if (!show) {
49
49
  setTimeout(function () {
50
- setShow(true);
50
+ setShow(function () {
51
+ var _domRef$current;
52
+
53
+ // bugfix:
54
+ // 外层CSSTransition使用dom API而非通过react className属性修改class
55
+ // 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
56
+ (_domRef$current = domRef.current) == null ? void 0 : _domRef$current.classList.add('show');
57
+ return true;
58
+ });
51
59
  }, 0);
52
60
  }
53
61
  }
@@ -99,7 +107,6 @@ export var PopoverInner = /*#__PURE__*/forwardRef(function (props, ref) {
99
107
  return /*#__PURE__*/React.createElement("div", {
100
108
  ref: domRef,
101
109
  className: cls(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
102
- show: show,
103
110
  'with-shadow': needShadow,
104
111
  'with-suffix': showCloseIcon || textSuffix,
105
112
  'custom-content': typeof content !== 'string'
@@ -60,8 +60,12 @@ export function useMountedState(initialState) {
60
60
  }
61
61
  setState(value);
62
62
  }, []);
63
- useEffect(() => () => {
64
- leavingRef.current = true;
63
+ useEffect(() => {
64
+ // see: https://github.com/arco-design/arco-design-mobile/pull/292
65
+ leavingRef.current = false;
66
+ return () => {
67
+ leavingRef.current = true;
68
+ };
65
69
  }, []);
66
70
  const result = [state, setValidState];
67
71
  return result;
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef, useState, useMemo, forwardRef, useImperativeHandle, } from 'react';
2
- import { cls, componentWrapper, formatDateNumber } from '@arco-design/mobile-utils';
2
+ import { cls, componentWrapper, formatDateNumber, isEmptyValue } from '@arco-design/mobile-utils';
3
3
  import Picker from '../picker';
4
4
  import { ContextLayout } from '../context-provider';
5
5
  import { convertTsToDateObj, oneOf, judgeObj, convertObjToTs } from './helper';
@@ -202,7 +202,7 @@ const DatePicker = forwardRef((props, ref) => {
202
202
  }
203
203
  }, [visible]);
204
204
  return (React.createElement(ContextLayout, null, ({ prefixCls }) => (React.createElement(Picker, Object.assign({}, otherProps, { ref: pickerRef, visible: visible, className: cls(className, `${prefixCls}-date-picker`), cascade: false, data: data, value: value, onPickerChange: _handlePickerChange, onOk: _handlePickerConfirm, touchToStop: touchToStop, renderLinkedContainer: renderLinkedContainer
205
- ? () => renderLinkedContainer(currentTs, keyOptions)
205
+ ? () => renderLinkedContainer(isEmptyValue(props.currentTs) ? undefined : currentTs, keyOptions)
206
206
  : undefined })))));
207
207
  });
208
208
  /**
@@ -110,5 +110,5 @@ export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' |
110
110
  * 将选择器的展现隐藏状态及选中值的展示与某个容器关联,传入后将同时渲染该容器和选择器组件,此时选择器组件的 visible 和 onHide 属性可不传,点击该容器会唤起选择器
111
111
  * @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
112
112
  */
113
- renderLinkedContainer?: (currentTs: number, itemTypes: ItemType[]) => ReactNode;
113
+ renderLinkedContainer?: (currentTs: number | undefined, itemTypes: ItemType[]) => ReactNode;
114
114
  }
@@ -542,10 +542,12 @@
542
542
  .arco-divider::before {
543
543
  content: '';
544
544
  }
545
- .arco-divider--hairline::before,
546
- .arco-divider--hairline::after {
547
- -webkit-transform: scaleY(0.5);
548
- transform: scaleY(0.5);
545
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
546
+ .arco-divider--hairline::before,
547
+ .arco-divider--hairline::after {
548
+ -webkit-transform: scaleY(0.5);
549
+ transform: scaleY(0.5);
550
+ }
549
551
  }
550
552
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
551
553
  .arco-divider--hairline::before,
@@ -27,7 +27,9 @@
27
27
  &--hairline {
28
28
  &::before,
29
29
  &::after {
30
- transform: scaleY(0.5);
30
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
31
+ transform: scaleY(0.5);
32
+ }
31
33
 
32
34
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
33
35
  transform: scaleY(0.33333333);
@@ -1,4 +1,4 @@
1
- import { cls, removeElement, fadeColor, nextTick } from '@arco-design/mobile-utils';
1
+ import { cls, fadeColor, nextTick } from '@arco-design/mobile-utils';
2
2
  import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useMemo, useContext, } from 'react';
3
3
  import { ContextLayout, GlobalContext } from '../context-provider';
4
4
  import IconClose from '../icon/IconClose';
@@ -17,6 +17,7 @@ const NoticeBar = forwardRef((props, ref) => {
17
17
  const wrapRef = useRef(null);
18
18
  const contentRef = useRef(null);
19
19
  const timerRef = useRef(null);
20
+ const [visible, setVisible] = useState(true);
20
21
  const [needMarquee, setNeedMarquee] = useState(false);
21
22
  const extraClass = useMemo(() => {
22
23
  const classList = [];
@@ -53,9 +54,8 @@ const NoticeBar = forwardRef((props, ref) => {
53
54
  updateData();
54
55
  }, [useRtl]);
55
56
  function close() {
56
- if (domRef.current) {
57
- removeElement(domRef.current);
58
- }
57
+ setVisible(false);
58
+ clear();
59
59
  }
60
60
  function handleClose(e) {
61
61
  e.stopPropagation();
@@ -112,14 +112,14 @@ const NoticeBar = forwardRef((props, ref) => {
112
112
  }
113
113
  }
114
114
  function renderNoticeBar(prefix) {
115
- return (React.createElement("div", { className: cls(prefix, className, extraClass), style: style, ref: domRef, onClick: onClick },
115
+ return visible ? (React.createElement("div", { className: cls(prefix, className, extraClass), style: style, ref: domRef, onClick: onClick },
116
116
  leftContent ? React.createElement("div", { className: `${prefix}-left-part` }, leftContent) : null,
117
117
  React.createElement("div", { className: `${prefix}-content`, ref: wrapRef },
118
118
  needMarquee ? (React.createElement("i", { className: `${prefix}-gradient left`, style: gradientStyle })) : null,
119
119
  React.createElement("div", { className: cls(`${prefix}-content-inner`, { animate: needMarquee }), ref: contentRef }, children),
120
120
  needMarquee ? (React.createElement("i", { className: `${prefix}-gradient right`, style: gradientStyle })) : null),
121
121
  rightContent ? React.createElement("div", { className: `${prefix}-right-part` }, rightContent) : null,
122
- closeable ? (React.createElement("div", { className: `${prefix}-close`, onClick: handleClose }, closeIcon)) : null));
122
+ closeable ? (React.createElement("div", { className: `${prefix}-close`, onClick: handleClose }, closeIcon)) : null)) : null;
123
123
  }
124
124
  return (React.createElement(ContextLayout, null, ({ prefixCls }) => renderNoticeBar(`${prefixCls}-notice-bar`)));
125
125
  });
@@ -18,7 +18,13 @@ export const PopoverInner = forwardRef((props, ref) => {
18
18
  if (left || width || top || height || bottom) {
19
19
  if (!show) {
20
20
  setTimeout(() => {
21
- setShow(true);
21
+ setShow(() => {
22
+ // bugfix:
23
+ // 外层CSSTransition使用dom API而非通过react className属性修改class
24
+ // 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
25
+ domRef.current?.classList.add('show');
26
+ return true;
27
+ });
22
28
  }, 0);
23
29
  }
24
30
  }
@@ -60,7 +66,6 @@ export const PopoverInner = forwardRef((props, ref) => {
60
66
  };
61
67
  };
62
68
  return (React.createElement("div", { ref: domRef, className: cls(`${prefixCls}-popover-inner`, 'popover-inner', 'all-border-box', `${mode}-mode`, className, {
63
- show,
64
69
  'with-shadow': needShadow,
65
70
  'with-suffix': showCloseIcon || textSuffix,
66
71
  'custom-content': typeof content !== 'string',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco-design/mobile-react",
3
- "version": "2.33.0",
3
+ "version": "2.35.0",
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.20.0",
18
+ "@arco-design/mobile-utils": "2.20.2",
19
19
  "@arco-design/transformable": "^1.0.0",
20
20
  "@babel/runtime": "^7",
21
21
  "lodash.throttle": "^4.1.1",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "7b0a8e3446dd2429a7a14a4a4d86688aa726887f"
50
+ "gitHead": "efb0db8d0e3ecdd787266dce595b2990e80bbefa"
51
51
  }
@@ -1,7 +1,8 @@
1
1
  @import '../../../mixin/index.less';
2
2
 
3
3
  :root when (@use-css-vars = 1) {
4
- --prefix: arco;
4
+ --prefix: var(--prefix-mobile);
5
+ --prefix-mobile: arco;
5
6
  --base-font-size: 50;
6
7
  --arco-dark-mode-selector: .arco-theme-dark;
7
8
  --background-color: #FFFFFF;
@@ -1,6 +1,7 @@
1
1
  export declare function getRem(px: number, baseFontSize: number): string;
2
2
  export interface ArcodesignToken extends Record<string, string> {
3
3
  'prefix': string;
4
+ 'prefix-mobile': string;
4
5
  'base-font-size': string;
5
6
  'arco-dark-mode-selector': string;
6
7
  'background-color': string;
@@ -12,7 +12,8 @@ function getRem(px, baseFontSize) {
12
12
  }
13
13
 
14
14
  var tokens = {
15
- "prefix": "arco",
15
+ "prefix": "var(--prefix-mobile)",
16
+ "prefix-mobile": "arco",
16
17
  "base-font-size": "50",
17
18
  "arco-dark-mode-selector": ".arco-theme-dark",
18
19
  "background-color": "#FFFFFF",
@@ -8049,14 +8049,27 @@
8049
8049
  "cssKey": "prefix",
8050
8050
  "desc": "类前缀,需配合 context-provider 中的 prefixCls 使用",
8051
8051
  "override": "",
8052
- "value": "arco",
8053
- "jsValue": "arco",
8052
+ "value": "@prefix-mobile",
8053
+ "jsValue": "@global@prefixMobile",
8054
8054
  "staticValue": "arco",
8055
8055
  "localeDesc": {
8056
8056
  "ch": "类前缀,需配合 context-provider 中的 prefixCls 使用",
8057
+ "default": "'arco'",
8057
8058
  "en": "Classname prefix, it needs to be used with prefixCls in context-provider"
8058
8059
  }
8059
8060
  },
8061
+ "prefixMobile": {
8062
+ "cssKey": "prefix-mobile",
8063
+ "desc": "功能同 prefix,与 PC 版同用时可使用该变量修改类前缀解决冲突",
8064
+ "override": "",
8065
+ "value": "arco",
8066
+ "jsValue": "arco",
8067
+ "staticValue": "arco",
8068
+ "localeDesc": {
8069
+ "ch": "功能同 prefix,与 PC 版同用时可使用该变量修改类前缀解决冲突",
8070
+ "en": "Same as `prefix`, it can avoid conflicts when used with arco pc"
8071
+ }
8072
+ },
8060
8073
  "primaryColor": {
8061
8074
  "cssKey": "primary-color",
8062
8075
  "desc": "基础主题色",
@@ -1,6 +1,7 @@
1
1
  @import '../../../mixin/pxtorem.less';
2
2
 
3
- @prefix: arco;
3
+ @prefix: @prefix-mobile;
4
+ @prefix-mobile: arco;
4
5
  @base-font-size: 50;
5
6
  @arco-dark-mode-selector: .arco-theme-dark;
6
7
  @background-color: #FFFFFF;
@@ -108,6 +108,8 @@
108
108
  setState(value);
109
109
  }, []);
110
110
  (0, _react.useEffect)(function () {
111
+ // see: https://github.com/arco-design/arco-design-mobile/pull/292
112
+ leavingRef.current = false;
111
113
  return function () {
112
114
  leavingRef.current = true;
113
115
  };
@@ -345,7 +345,7 @@
345
345
  onOk: _handlePickerConfirm,
346
346
  touchToStop: touchToStop,
347
347
  renderLinkedContainer: renderLinkedContainer ? function () {
348
- return renderLinkedContainer(currentTs, keyOptions);
348
+ return renderLinkedContainer((0, _mobileUtils.isEmptyValue)(props.currentTs) ? undefined : currentTs, keyOptions);
349
349
  } : undefined
350
350
  }));
351
351
  });
@@ -110,5 +110,5 @@ export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' |
110
110
  * 将选择器的展现隐藏状态及选中值的展示与某个容器关联,传入后将同时渲染该容器和选择器组件,此时选择器组件的 visible 和 onHide 属性可不传,点击该容器会唤起选择器
111
111
  * @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
112
112
  */
113
- renderLinkedContainer?: (currentTs: number, itemTypes: ItemType[]) => ReactNode;
113
+ renderLinkedContainer?: (currentTs: number | undefined, itemTypes: ItemType[]) => ReactNode;
114
114
  }
@@ -542,10 +542,12 @@
542
542
  .arco-divider::before {
543
543
  content: '';
544
544
  }
545
- .arco-divider--hairline::before,
546
- .arco-divider--hairline::after {
547
- -webkit-transform: scaleY(0.5);
548
- transform: scaleY(0.5);
545
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
546
+ .arco-divider--hairline::before,
547
+ .arco-divider--hairline::after {
548
+ -webkit-transform: scaleY(0.5);
549
+ transform: scaleY(0.5);
550
+ }
549
551
  }
550
552
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
551
553
  .arco-divider--hairline::before,
@@ -27,7 +27,9 @@
27
27
  &--hairline {
28
28
  &::before,
29
29
  &::after {
30
- transform: scaleY(0.5);
30
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
31
+ transform: scaleY(0.5);
32
+ }
31
33
 
32
34
  @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
33
35
  transform: scaleY(0.33333333);
@@ -64,9 +64,13 @@
64
64
  var contentRef = (0, _react.useRef)(null);
65
65
  var timerRef = (0, _react.useRef)(null);
66
66
 
67
- var _useState = (0, _react.useState)(false),
68
- needMarquee = _useState[0],
69
- setNeedMarquee = _useState[1];
67
+ var _useState = (0, _react.useState)(true),
68
+ visible = _useState[0],
69
+ setVisible = _useState[1];
70
+
71
+ var _useState2 = (0, _react.useState)(false),
72
+ needMarquee = _useState2[0],
73
+ setNeedMarquee = _useState2[1];
70
74
 
71
75
  var extraClass = (0, _react.useMemo)(function () {
72
76
  var classList = []; // 字幕可滚动时,或不可滚动且不可以换行时,添加不换行效果
@@ -107,9 +111,8 @@
107
111
  }, [useRtl]);
108
112
 
109
113
  function close() {
110
- if (domRef.current) {
111
- (0, _mobileUtils.removeElement)(domRef.current);
112
- }
114
+ setVisible(false);
115
+ clear();
113
116
  }
114
117
 
115
118
  function handleClose(e) {
@@ -174,7 +177,7 @@
174
177
  }
175
178
 
176
179
  function renderNoticeBar(prefix) {
177
- return /*#__PURE__*/_react.default.createElement("div", {
180
+ return visible ? /*#__PURE__*/_react.default.createElement("div", {
178
181
  className: (0, _mobileUtils.cls)(prefix, className, extraClass),
179
182
  style: style,
180
183
  ref: domRef,
@@ -200,7 +203,7 @@
200
203
  }, rightContent) : null, closeable ? /*#__PURE__*/_react.default.createElement("div", {
201
204
  className: prefix + "-close",
202
205
  onClick: handleClose
203
- }, closeIcon) : null);
206
+ }, closeIcon) : null) : null;
204
207
  }
205
208
 
206
209
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
@@ -68,7 +68,15 @@
68
68
  if (left || width || top || height || bottom) {
69
69
  if (!show) {
70
70
  setTimeout(function () {
71
- setShow(true);
71
+ setShow(function () {
72
+ var _domRef$current;
73
+
74
+ // bugfix:
75
+ // 外层CSSTransition使用dom API而非通过react className属性修改class
76
+ // 如果内部通过react className属性动态修改class会覆盖CSSTransition的设置,导致CSSTransition enter相关的class无法应用到组件
77
+ (_domRef$current = domRef.current) == null ? void 0 : _domRef$current.classList.add('show');
78
+ return true;
79
+ });
72
80
  }, 0);
73
81
  }
74
82
  }
@@ -120,7 +128,6 @@
120
128
  return /*#__PURE__*/_react.default.createElement("div", {
121
129
  ref: domRef,
122
130
  className: (0, _mobileUtils.cls)(prefixCls + "-popover-inner", 'popover-inner', 'all-border-box', mode + "-mode", className, {
123
- show: show,
124
131
  'with-shadow': needShadow,
125
132
  'with-suffix': showCloseIcon || textSuffix,
126
133
  'custom-content': typeof content !== 'string'