@tarojs/plugin-platform-harmony-ets 4.0.0-beta.43 → 4.0.0-beta.45

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.
@@ -38,7 +38,7 @@ export function convertNumber2PX (value: number) {
38
38
  return pxTransformHelper(value, 'vp')
39
39
  }
40
40
 
41
- export function convertNumber2VP (value: number, unit = 'px') {
41
+ export function convertNumber2VP (value: number, unit = 'px'): string | number {
42
42
  if (unit === 'vw' || unit === 'vh') {
43
43
  return (value / 100 * (unit === 'vw' ? display.width: display.height)) + 'px'
44
44
  }
@@ -52,8 +52,16 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
52
52
 
53
53
  componentDidMount () {
54
54
  this.ctx.component = this
55
- const rootElement = this.root.current!
56
- rootElement.ctx = this.ctx
55
+ if (this.root.current) {
56
+ this.root.current = this.ctx
57
+ }
58
+ }
59
+
60
+ // React 16 uncaught error 会导致整个应用 crash,
61
+ // 目前把错误缩小到页面
62
+ componentDidCatch (error, info: React.ErrorInfo) {
63
+ console.warn(error)
64
+ console.error(info.componentStack)
57
65
  }
58
66
 
59
67
  render () {
@@ -287,7 +287,7 @@ Current.contextPromise.then((context) => {
287
287
  return;
288
288
  }
289
289
  const top = Math.max(...boundingRects.map(rect => rect.top + rect.height), ((_a = waterfallDisplayAreaRects.top) === null || _a === void 0 ? void 0 : _a.top) + ((_b = waterfallDisplayAreaRects.top) === null || _b === void 0 ? void 0 : _b.height), statusBarHeight);
290
- const bottom = display$1.height - Math.min((_c = waterfallDisplayAreaRects.bottom) === null || _c === void 0 ? void 0 : _c.top, navigationIndicatorRect === null || navigationIndicatorRect === void 0 ? void 0 : navigationIndicatorRect.top);
290
+ const bottom = Math.min(display$1.height - ((_c = waterfallDisplayAreaRects.bottom) === null || _c === void 0 ? void 0 : _c.top), navigationIndicatorRect === null || navigationIndicatorRect === void 0 ? void 0 : navigationIndicatorRect.top);
291
291
  const left = ((_d = waterfallDisplayAreaRects.left) === null || _d === void 0 ? void 0 : _d.left) + ((_e = waterfallDisplayAreaRects.left) === null || _e === void 0 ? void 0 : _e.width);
292
292
  const right = display$1.width - ((_f = waterfallDisplayAreaRects.right) === null || _f === void 0 ? void 0 : _f.left);
293
293
  safeArea = {