@mpxjs/core 2.10.9 → 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.
|
|
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": "
|
|
112
|
+
"gitHead": "4ea2a49ba7989edb3b0e292ed41e357d476d70fc"
|
|
113
113
|
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { isObject, isArray, dash2hump, cached, isEmptyObject } from '@mpxjs/utils'
|
|
2
2
|
import { Dimensions, StyleSheet } from 'react-native'
|
|
3
|
+
import Mpx from '../../index'
|
|
4
|
+
|
|
5
|
+
const rawDimensions = {
|
|
6
|
+
screen: Dimensions.get('screen'),
|
|
7
|
+
window: Dimensions.get('window')
|
|
8
|
+
}
|
|
9
|
+
let width, height
|
|
3
10
|
|
|
4
|
-
let { width, height } = Dimensions.get('screen')
|
|
5
11
|
// TODO 临时适配折叠屏场景适配
|
|
6
|
-
const isLargeFoldableLike = (__mpx_mode__ === 'android') && (height / width < 1.5) && (width > 600)
|
|
7
|
-
if (isLargeFoldableLike) width = width / 2
|
|
12
|
+
// const isLargeFoldableLike = (__mpx_mode__ === 'android') && (height / width < 1.5) && (width > 600)
|
|
13
|
+
// if (isLargeFoldableLike) width = width / 2
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
15
|
+
function customDimensions (dimensions) {
|
|
16
|
+
if (typeof Mpx.config.rnConfig?.customDimensions === 'function') {
|
|
17
|
+
dimensions = Mpx.config.rnConfig.customDimensions(dimensions) || dimensions
|
|
18
|
+
}
|
|
19
|
+
width = dimensions.screen.width
|
|
20
|
+
height = dimensions.screen.height
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
customDimensions(rawDimensions)
|
|
24
|
+
Dimensions.addEventListener('change', customDimensions)
|
|
13
25
|
|
|
14
26
|
function rpx (value) {
|
|
15
27
|
// rn 单位 dp = 1(css)px = 1 物理像素 * pixelRatio(像素比)
|