@nutui/nutui-react-taro 3.0.19-cpp.11 → 3.0.19-cpp.12

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.
@@ -18,6 +18,7 @@ var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
18
18
  var _to_consumable_array = require("@swc/helpers/_/_to_consumable_array");
19
19
  var _ts_generator = require("@swc/helpers/_/_ts_generator");
20
20
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
21
+ var _taro = require("@tarojs/taro");
21
22
  var _components = require("@tarojs/components");
22
23
  var _iconsreacttaro = require("@nutui/icons-react-taro");
23
24
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
@@ -137,42 +138,51 @@ var NoticeBar = function NoticeBar(props) {
137
138
  if (showNoticeBar === false) {
138
139
  return;
139
140
  }
140
- setTimeout(function() {
141
+ (0, _taro.nextTick)(function() {
141
142
  return (0, _async_to_generator._)(function() {
142
143
  var warpRes, contentRes, wrapW, offsetW, canScroll;
143
144
  return (0, _ts_generator._)(this, function(_state) {
144
- if (!wrapRef.current || !contentRef.current) {
145
- return [
146
- 2
147
- ];
148
- }
149
- warpRes = wrapRef.current.getBoundingClientRect(); // await getRectInMultiPlatform(wrapRef.current, wrapRefId)
150
- contentRes = contentRef.current.getBoundingClientRect();
151
- // await getRectInMultiPlatform(
152
- // contentRef.current,
153
- // contentRefId
154
- // )
155
- if (!warpRes || !contentRes) return [
156
- 2
157
- ];
158
- wrapW = warpRes.width;
159
- offsetW = contentRes.width;
160
- canScroll = align === 'left' && scrollable == null ? offsetW > wrapW : scrollable;
161
- SetIsCanScroll(canScroll);
162
- if (canScroll) {
163
- SetWrapWidth(wrapW);
164
- SetOffsetW(offsetW);
165
- SetAnimationDuration(offsetW / speed);
166
- SetAnimationClass('play');
167
- } else {
168
- SetAnimationClass('');
145
+ switch(_state.label){
146
+ case 0:
147
+ if (!wrapRef.current || !contentRef.current) {
148
+ return [
149
+ 2
150
+ ];
151
+ }
152
+ return [
153
+ 4,
154
+ (0, _getrect.getRectInMultiPlatform)(wrapRef.current, wrapRefId)
155
+ ];
156
+ case 1:
157
+ warpRes = _state.sent();
158
+ return [
159
+ 4,
160
+ (0, _getrect.getRectInMultiPlatform)(contentRef.current, contentRefId)
161
+ ];
162
+ case 2:
163
+ contentRes = _state.sent();
164
+ if (!warpRes || !contentRes) return [
165
+ 2
166
+ ];
167
+ wrapW = warpRes.width;
168
+ offsetW = contentRes.width;
169
+ canScroll = align === 'left' && scrollable == null ? offsetW > wrapW : scrollable;
170
+ SetIsCanScroll(canScroll);
171
+ if (canScroll) {
172
+ SetWrapWidth(wrapW);
173
+ SetOffsetW(offsetW);
174
+ SetAnimationDuration(offsetW / speed);
175
+ SetAnimationClass('play');
176
+ } else {
177
+ SetAnimationClass('');
178
+ }
179
+ return [
180
+ 2
181
+ ];
169
182
  }
170
- return [
171
- 2
172
- ];
173
183
  });
174
184
  })();
175
- }, 0);
185
+ });
176
186
  };
177
187
  var handleClick = function handleClick(event) {
178
188
  click && click(event);
@@ -158,9 +158,11 @@ var Toast = function Toast(props) {
158
158
  style: (0, _object_spread._)({}, styles, contentStyle)
159
159
  }, renderIcon(), title && /*#__PURE__*/ _react.default.createElement(_components.Text, {
160
160
  className: "".concat(classPrefix, "-title")
161
- }, title), content && /*#__PURE__*/ _react.default.createElement(_components.Text, {
161
+ }, title), content && ((0, _platform.td)() ? /*#__PURE__*/ _react.default.createElement(_components.Text, {
162
162
  className: "".concat(classPrefix, "-text")
163
- }, content)))));
163
+ }, content) : /*#__PURE__*/ _react.default.createElement(_components.View, {
164
+ className: "".concat(classPrefix, "-text")
165
+ }, content))))));
164
166
  };
165
167
  function show(selector, options) {
166
168
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -6,6 +6,7 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
6
6
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
7
7
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
8
8
  import React, { useEffect, useMemo, useRef, useState, useCallback } from "react";
9
+ import { nextTick } from "@tarojs/taro";
9
10
  import { View } from "@tarojs/components";
10
11
  import { Close, Notice } from "@nutui/icons-react-taro";
11
12
  import classNames from "classnames";
@@ -125,42 +126,51 @@ export var NoticeBar = function(props) {
125
126
  if (showNoticeBar === false) {
126
127
  return;
127
128
  }
128
- setTimeout(function() {
129
+ nextTick(function() {
129
130
  return _async_to_generator(function() {
130
131
  var warpRes, contentRes, wrapW, offsetW, canScroll;
131
132
  return _ts_generator(this, function(_state) {
132
- if (!wrapRef.current || !contentRef.current) {
133
- return [
134
- 2
135
- ];
136
- }
137
- warpRes = wrapRef.current.getBoundingClientRect(); // await getRectInMultiPlatform(wrapRef.current, wrapRefId)
138
- contentRes = contentRef.current.getBoundingClientRect();
139
- // await getRectInMultiPlatform(
140
- // contentRef.current,
141
- // contentRefId
142
- // )
143
- if (!warpRes || !contentRes) return [
144
- 2
145
- ];
146
- wrapW = warpRes.width;
147
- offsetW = contentRes.width;
148
- canScroll = align === 'left' && scrollable == null ? offsetW > wrapW : scrollable;
149
- SetIsCanScroll(canScroll);
150
- if (canScroll) {
151
- SetWrapWidth(wrapW);
152
- SetOffsetW(offsetW);
153
- SetAnimationDuration(offsetW / speed);
154
- SetAnimationClass('play');
155
- } else {
156
- SetAnimationClass('');
133
+ switch(_state.label){
134
+ case 0:
135
+ if (!wrapRef.current || !contentRef.current) {
136
+ return [
137
+ 2
138
+ ];
139
+ }
140
+ return [
141
+ 4,
142
+ getRectInMultiPlatform(wrapRef.current, wrapRefId)
143
+ ];
144
+ case 1:
145
+ warpRes = _state.sent();
146
+ return [
147
+ 4,
148
+ getRectInMultiPlatform(contentRef.current, contentRefId)
149
+ ];
150
+ case 2:
151
+ contentRes = _state.sent();
152
+ if (!warpRes || !contentRes) return [
153
+ 2
154
+ ];
155
+ wrapW = warpRes.width;
156
+ offsetW = contentRes.width;
157
+ canScroll = align === 'left' && scrollable == null ? offsetW > wrapW : scrollable;
158
+ SetIsCanScroll(canScroll);
159
+ if (canScroll) {
160
+ SetWrapWidth(wrapW);
161
+ SetOffsetW(offsetW);
162
+ SetAnimationDuration(offsetW / speed);
163
+ SetAnimationClass('play');
164
+ } else {
165
+ SetAnimationClass('');
166
+ }
167
+ return [
168
+ 2
169
+ ];
157
170
  }
158
- return [
159
- 2
160
- ];
161
171
  });
162
172
  })();
163
- }, 0);
173
+ });
164
174
  };
165
175
  var handleClick = function(event) {
166
176
  click && click(event);
@@ -11,7 +11,7 @@ import { defaultOverlayProps } from "../overlay/overlay";
11
11
  import { customEvents, useCustomEvent, useCustomEventsPath, useParams } from "../../hooks/taro/use-custom-event";
12
12
  import { usePropsValue } from "../../hooks/use-props-value";
13
13
  import { useRtl } from "../configprovider/index";
14
- import { harmony } from "../../utils/taro/platform";
14
+ import { harmony, td } from "../../utils/taro/platform";
15
15
  import { mergeProps } from "../../utils/merge-props";
16
16
  var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps), {
17
17
  id: '',
@@ -135,9 +135,11 @@ export var Toast = function(props) {
135
135
  style: _object_spread({}, styles, contentStyle)
136
136
  }, renderIcon(), title && /*#__PURE__*/ React.createElement(Text, {
137
137
  className: "".concat(classPrefix, "-title")
138
- }, title), content && /*#__PURE__*/ React.createElement(Text, {
138
+ }, title), content && (td() ? /*#__PURE__*/ React.createElement(Text, {
139
139
  className: "".concat(classPrefix, "-text")
140
- }, content)))));
140
+ }, content) : /*#__PURE__*/ React.createElement(View, {
141
+ className: "".concat(classPrefix, "-text")
142
+ }, content))))));
141
143
  };
142
144
  export function show(selector, options) {
143
145
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -15888,38 +15888,51 @@
15888
15888
  if (showNoticeBar === false) {
15889
15889
  return;
15890
15890
  }
15891
- setTimeout(function() {
15891
+ Taro.nextTick(function() {
15892
15892
  return _async_to_generator(function() {
15893
15893
  var warpRes, contentRes, wrapW, offsetW, canScroll;
15894
15894
  return __generator(this, function(_state) {
15895
- if (!wrapRef.current || !contentRef.current) {
15896
- return [
15897
- 2
15898
- ];
15899
- }
15900
- warpRes = wrapRef.current.getBoundingClientRect();
15901
- contentRes = contentRef.current.getBoundingClientRect();
15902
- if (!warpRes || !contentRes) return [
15903
- 2
15904
- ];
15905
- wrapW = warpRes.width;
15906
- offsetW = contentRes.width;
15907
- canScroll = align === "left" && scrollable == null ? offsetW > wrapW : scrollable;
15908
- SetIsCanScroll(canScroll);
15909
- if (canScroll) {
15910
- SetWrapWidth(wrapW);
15911
- SetOffsetW(offsetW);
15912
- SetAnimationDuration(offsetW / speed);
15913
- SetAnimationClass("play");
15914
- } else {
15915
- SetAnimationClass("");
15895
+ switch (_state.label) {
15896
+ case 0:
15897
+ if (!wrapRef.current || !contentRef.current) {
15898
+ return [
15899
+ 2
15900
+ ];
15901
+ }
15902
+ return [
15903
+ 4,
15904
+ getRectInMultiPlatform(wrapRef.current, wrapRefId)
15905
+ ];
15906
+ case 1:
15907
+ warpRes = _state.sent();
15908
+ return [
15909
+ 4,
15910
+ getRectInMultiPlatform(contentRef.current, contentRefId)
15911
+ ];
15912
+ case 2:
15913
+ contentRes = _state.sent();
15914
+ if (!warpRes || !contentRes) return [
15915
+ 2
15916
+ ];
15917
+ wrapW = warpRes.width;
15918
+ offsetW = contentRes.width;
15919
+ canScroll = align === "left" && scrollable == null ? offsetW > wrapW : scrollable;
15920
+ SetIsCanScroll(canScroll);
15921
+ if (canScroll) {
15922
+ SetWrapWidth(wrapW);
15923
+ SetOffsetW(offsetW);
15924
+ SetAnimationDuration(offsetW / speed);
15925
+ SetAnimationClass("play");
15926
+ } else {
15927
+ SetAnimationClass("");
15928
+ }
15929
+ return [
15930
+ 2
15931
+ ];
15916
15932
  }
15917
- return [
15918
- 2
15919
- ];
15920
15933
  });
15921
15934
  })();
15922
- }, 0);
15935
+ });
15923
15936
  };
15924
15937
  var handleClick = function(event) {
15925
15938
  click && click(event);
@@ -17357,9 +17370,11 @@
17357
17370
  style: _object_spread({}, styles, contentStyle)
17358
17371
  }, renderIcon(), title && /* @__PURE__ */ React.createElement(components.Text, {
17359
17372
  className: "".concat(classPrefix2, "-title")
17360
- }, title), content2 && /* @__PURE__ */ React.createElement(components.Text, {
17373
+ }, title), content2 && (td() ? /* @__PURE__ */ React.createElement(components.Text, {
17374
+ className: "".concat(classPrefix2, "-text")
17375
+ }, content2) : /* @__PURE__ */ React.createElement(components.View, {
17361
17376
  className: "".concat(classPrefix2, "-text")
17362
- }, content2)))));
17377
+ }, content2))))));
17363
17378
  };
17364
17379
  function show(selector, options) {
17365
17380
  var path = useCustomEventsPath(selector);