@tarojs/plugin-platform-harmony-ets 4.0.0-beta.73 → 4.0.0-beta.75

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/runtime.js CHANGED
@@ -2352,7 +2352,7 @@ const chooseImage = function (options) {
2352
2352
  photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
2353
2353
  photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
2354
2354
  photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
2355
- callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris });
2355
+ callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris }, options);
2356
2356
  }).catch((error) => {
2357
2357
  callAsyncFail(reject, error, options);
2358
2358
  });
@@ -3817,10 +3817,13 @@ const hideHomeButton = function (options) {
3817
3817
  };
3818
3818
 
3819
3819
  const startPullDownRefresh = function (options) {
3820
- return new Promise(resolve => {
3820
+ return new Promise((resolve, reject) => {
3821
3821
  var _a;
3822
3822
  const taro = Current.taro;
3823
3823
  const page = taro.getCurrentInstance().page;
3824
+ if (!page) {
3825
+ return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options);
3826
+ }
3824
3827
  if (page.isRefreshing instanceof Array) {
3825
3828
  const index = page.tabBarCurrentIndex || 0;
3826
3829
  page.isRefreshing[index] = true;
@@ -3834,10 +3837,13 @@ const startPullDownRefresh = function (options) {
3834
3837
  });
3835
3838
  };
3836
3839
  const stopPullDownRefresh = function (options) {
3837
- return new Promise(resolve => {
3840
+ return new Promise((resolve, reject) => {
3838
3841
  var _a;
3839
3842
  const taro = Current.taro;
3840
3843
  const page = taro.getCurrentInstance().page;
3844
+ if (!page) {
3845
+ return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options);
3846
+ }
3841
3847
  if (page.isRefreshing instanceof Array) {
3842
3848
  const index = page.tabBarCurrentIndex || 0;
3843
3849
  page.isRefreshing[index] = false;
@@ -3870,8 +3876,8 @@ const pageScrollTo = (options) => {
3870
3876
  const taro = Current.taro;
3871
3877
  const page = taro.getCurrentInstance().page;
3872
3878
  let scrollValue = -1;
3873
- let scroller = getPageScrollerOrNode(page.scroller, page);
3874
- const currentPageNode = getPageScrollerOrNode(page.node, page);
3879
+ let scroller = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.scroller, page);
3880
+ const currentPageNode = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
3875
3881
  if (scrollTop || typeof scrollTop === 'number') {
3876
3882
  scrollValue = scrollTop;
3877
3883
  }
@@ -3896,12 +3902,12 @@ const pageScrollTo = (options) => {
3896
3902
  scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper$1(offsetTop, 'px', true);
3897
3903
  }
3898
3904
  }
3899
- const { xOffset } = scroller.currentOffset();
3900
- if (scrollValue === -1) {
3905
+ if (!scroller || scrollValue === -1) {
3901
3906
  return handle.fail({
3902
3907
  errMsg: '请检查传入的 scrollTop 或 selector 是否合法'
3903
3908
  }, { resolve, reject });
3904
3909
  }
3910
+ const { xOffset } = scroller.currentOffset();
3905
3911
  try {
3906
3912
  scroller.scrollTo({
3907
3913
  xOffset,
@@ -3933,7 +3939,7 @@ const toggleTabBar = function (type) {
3933
3939
  var _a, _b;
3934
3940
  const taro = Current.taro;
3935
3941
  const page = taro.getCurrentInstance().page;
3936
- const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
3942
+ const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
3937
3943
  const res = { errMsg: `${type}TabBar:ok` };
3938
3944
  const error = { errMsg: `${type}TabBar:fail not TabBar page` };
3939
3945
  if (!currentData) {
@@ -3958,7 +3964,7 @@ const setTabBarStyle = function (options = {}) {
3958
3964
  var _a, _b;
3959
3965
  const taro = Current.taro;
3960
3966
  const page = taro.getCurrentInstance().page;
3961
- const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
3967
+ const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
3962
3968
  const res = { errMsg: 'setTabBarStyle:ok' };
3963
3969
  const error = { errMsg: 'setTabBarStyle:fail not TabBar page' };
3964
3970
  if (!currentData) {
@@ -3985,7 +3991,7 @@ const setTabBarItem = function (options) {
3985
3991
  var _a, _b;
3986
3992
  const taro = Current.taro;
3987
3993
  const page = taro.getCurrentInstance().page;
3988
- const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
3994
+ const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
3989
3995
  const res = { errMsg: 'setTabBarItem:ok' };
3990
3996
  const error = { errMsg: 'setTabBarItem:fail not TabBar page' };
3991
3997
  if (!currentData) {
@@ -4361,8 +4367,8 @@ function queryBat(queue, cb) {
4361
4367
  const result = [];
4362
4368
  const taro = Current.taro;
4363
4369
  const page = taro.getCurrentInstance().page;
4364
- const element = getPageScrollerOrNode(page.node, page);
4365
- if (element == null)
4370
+ const element = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
4371
+ if (!element)
4366
4372
  return null;
4367
4373
  arr = [];
4368
4374
  traversalDFSDom(element);