@mpxjs/core 2.10.10 → 2.10.11

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/core",
3
- "version": "2.10.10",
3
+ "version": "2.10.11",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -109,5 +109,5 @@
109
109
  "url": "https://github.com/didi/mpx/issues"
110
110
  },
111
111
  "sideEffects": false,
112
- "gitHead": "cee4b9ba7c2b455ebb864cbad7d2a8374b2d7308"
112
+ "gitHead": "4ea2a49ba7989edb3b0e292ed41e357d476d70fc"
113
113
  }
@@ -2,7 +2,7 @@ import { isObject, isArray, dash2hump, cached, isEmptyObject } from '@mpxjs/util
2
2
  import { Dimensions, StyleSheet } from 'react-native'
3
3
  import Mpx from '../../index'
4
4
 
5
- let dimensionsInfo = {
5
+ const rawDimensions = {
6
6
  screen: Dimensions.get('screen'),
7
7
  window: Dimensions.get('window')
8
8
  }
@@ -12,16 +12,16 @@ let width, height
12
12
  // const isLargeFoldableLike = (__mpx_mode__ === 'android') && (height / width < 1.5) && (width > 600)
13
13
  // if (isLargeFoldableLike) width = width / 2
14
14
 
15
- function customDimensionsInfo (dimensions) {
16
- if (typeof Mpx.config.rnConfig?.customDimensionsInfo === 'function') {
17
- dimensionsInfo = Mpx.config.rnConfig.customDimensionsInfo(dimensions) || dimensions
18
- width = dimensionsInfo.screen.width
19
- height = dimensionsInfo.screen.height
15
+ function customDimensions (dimensions) {
16
+ if (typeof Mpx.config.rnConfig?.customDimensions === 'function') {
17
+ dimensions = Mpx.config.rnConfig.customDimensions(dimensions) || dimensions
20
18
  }
19
+ width = dimensions.screen.width
20
+ height = dimensions.screen.height
21
21
  }
22
22
 
23
- customDimensionsInfo(dimensionsInfo)
24
- Dimensions.addEventListener('change', customDimensionsInfo)
23
+ customDimensions(rawDimensions)
24
+ Dimensions.addEventListener('change', customDimensions)
25
25
 
26
26
  function rpx (value) {
27
27
  // rn 单位 dp = 1(css)px = 1 物理像素 * pixelRatio(像素比)