@mpxjs/api-proxy 2.10.4-beta.1 → 2.10.4-beta.3

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.4-beta.1",
3
+ "version": "2.10.4-beta.3",
4
4
  "description": "convert miniprogram API at each end",
5
5
  "module": "src/index.js",
6
6
  "types": "@types/index.d.ts",
@@ -95,21 +95,25 @@ class RNIntersectionObserver {
95
95
  const navigationLayout = navigation.layout || {
96
96
  x: 0,
97
97
  y: 0,
98
+ top: 0,
99
+ left: 0,
98
100
  width: screen.width,
99
101
  height: screen.height
100
102
  }
101
103
 
102
104
  const windowRect = {
103
- top: navigationLayout.y - this.margins.top,
105
+ top: navigationLayout.top - this.margins.top,
104
106
  left: 0 - this.margins.left,
105
107
  right: navigationLayout.width + this.margins.right,
106
- bottom: navigationLayout.y + navigationLayout.height + this.margins.bottom
108
+ bottom: navigationLayout.top + navigationLayout.height + this.margins.bottom
107
109
  }
108
110
  this.windowRect = windowRect
109
111
  return this.windowRect
110
112
  }
111
113
 
112
114
  _getReferenceRect (targetRef) {
115
+ const navigation = getFocusedNavigation() || {}
116
+ const layout = navigation.layout || {}
113
117
  const targetRefs = isArray(targetRef) ? targetRef : [targetRef]
114
118
  const targetPromiseQueue = []
115
119
  targetRefs.forEach((targetRefItem) => {
@@ -127,11 +131,12 @@ class RNIntersectionObserver {
127
131
  targetPromiseQueue.push(new Promise((resolve) => {
128
132
  target.measureInWindow(
129
133
  (x, y, width, height) => {
134
+ // 安卓measureInWindow的参考值在android下为statubar的左下角,因此top需要调整一下
130
135
  const boundingClientRect = {
131
136
  left: x,
132
- top: y,
137
+ top: y + layout.statusBarHeight || 0,
133
138
  right: x + width,
134
- bottom: y + height,
139
+ bottom: y + height + layout.statusBarHeight || 0,
135
140
  width: width,
136
141
  height: height
137
142
  }
@@ -7,7 +7,9 @@ function setNavigationBarTitle (options = {}) {
7
7
  failHandle({ errMsg: 'setNavigationBarTitle:fail' }, fail, complete)
8
8
  } else {
9
9
  nextTick(() => {
10
- navigation.setOptions({ title: title.trim() })
10
+ navigation.setPageConfig({
11
+ navigationBarTitleText: title.trim()
12
+ })
11
13
  successHandle({ errMsg: 'setNavigationBarTitle:ok' }, success, complete)
12
14
  })
13
15
  }
@@ -20,11 +22,9 @@ function setNavigationBarColor (options = {}) {
20
22
  failHandle({ errMsg: 'setNavigationBarColor:fail' }, fail, complete)
21
23
  } else {
22
24
  nextTick(() => {
23
- navigation.setOptions({
24
- headerStyle: {
25
- backgroundColor: backgroundColor
26
- },
27
- headerTintColor: frontColor
25
+ navigation.setPageConfig({
26
+ navigationBarBackgroundColor: backgroundColor,
27
+ navigationBarTextStyle: frontColor
28
28
  })
29
29
  successHandle({ errMsg: 'setNavigationBarColor:ok' }, success, complete)
30
30
  })
@@ -7,10 +7,9 @@ const getWindowInfo = function () {
7
7
  const navigation = getFocusedNavigation() || {}
8
8
  const initialWindowMetricsInset = initialWindowMetrics?.insets || {}
9
9
  const navigationInsets = navigation.insets || {}
10
- const insets = Object.assign(initialWindowMetricsInset, navigationInsets)
10
+ const insets = Object.assign({}, initialWindowMetricsInset, navigationInsets)
11
11
  let safeArea = {}
12
12
  const { top = 0, bottom = 0, left = 0, right = 0 } = insets
13
-
14
13
  const screenHeight = __mpx_mode__ === 'ios' ? dimensionsScreen.height : dimensionsScreen.height - bottom // 解决安卓开启屏幕内三建导航安卓把安全区计算进去后产生的影响
15
14
  const screenWidth = __mpx_mode__ === 'ios' ? dimensionsScreen.width : dimensionsScreen.width - right
16
15
  const layout = navigation.layout || {}