@mpxjs/api-proxy 2.10.6-beta.1 → 2.10.6-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/api-proxy",
3
- "version": "2.10.6-beta.1",
3
+ "version": "2.10.6-beta.4",
4
4
  "description": "convert miniprogram API at each end",
5
5
  "module": "src/index.js",
6
6
  "types": "@types/index.d.ts",
@@ -4,7 +4,8 @@ global.__mpxAppCbs = global.__mpxAppCbs || {
4
4
  show: [],
5
5
  hide: [],
6
6
  error: [],
7
- rejection: []
7
+ rejection: [],
8
+ lazyLoad: []
8
9
  }
9
10
 
10
11
  function off (cbs, cb) {
@@ -56,6 +57,18 @@ function offAppHide (callback) {
56
57
  off(global.__mpxAppCbs.hide, callback)
57
58
  }
58
59
 
60
+ function onLazyLoadError (callback) {
61
+ if (isReact) {
62
+ global.__mpxAppCbs.lazyLoad.push(callback)
63
+ }
64
+ }
65
+
66
+ function offLazyLoadError (callback) {
67
+ if (isReact) {
68
+ off(global.__mpxAppCbs.lazyLoad, callback)
69
+ }
70
+ }
71
+
59
72
  export {
60
73
  onAppShow,
61
74
  onAppHide,
@@ -64,5 +77,7 @@ export {
64
77
  onError,
65
78
  offError,
66
79
  onUnhandledRejection,
67
- offUnhandledRejection
80
+ offUnhandledRejection,
81
+ onLazyLoadError,
82
+ offLazyLoadError
68
83
  }
@@ -93,8 +93,6 @@ class RNIntersectionObserver {
93
93
  const navigation = getFocusedNavigation() || {}
94
94
  const screen = Dimensions.get('screen')
95
95
  const navigationLayout = navigation.layout || {
96
- x: 0,
97
- y: 0,
98
96
  top: 0,
99
97
  left: 0,
100
98
  width: screen.width,
@@ -4,7 +4,8 @@ import {
4
4
  dash2hump,
5
5
  collectDataset,
6
6
  hump2dash,
7
- isArray
7
+ isArray,
8
+ getFocusedNavigation
8
9
  } from '@mpxjs/utils'
9
10
 
10
11
  const flushRefFns = (nodeInstances, fns, single) => {
@@ -40,8 +41,10 @@ const wrapFn = (fn) => {
40
41
  const getMeasureProps = (measureProps = []) => {
41
42
  return wrapFn((nodeInstance, resolve) => {
42
43
  const nodeRef = nodeInstance.nodeRef.current
44
+ const navigation = getFocusedNavigation()
43
45
  setTimeout(() => {
44
46
  nodeRef.measure(function (x, y, width, height, pageX, pageY) {
47
+ pageY = pageY - navigation.layout.top
45
48
  const rectAndSize = {
46
49
  width,
47
50
  height,