@mpxjs/core 2.10.8 → 2.10.10
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.10",
|
|
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": "cee4b9ba7c2b455ebb864cbad7d2a8374b2d7308"
|
|
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
|
+
let dimensionsInfo = {
|
|
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
|
|
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
|
|
20
|
+
}
|
|
21
|
+
}
|
|
8
22
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
height = screen.height
|
|
12
|
-
})
|
|
23
|
+
customDimensionsInfo(dimensionsInfo)
|
|
24
|
+
Dimensions.addEventListener('change', customDimensionsInfo)
|
|
13
25
|
|
|
14
26
|
function rpx (value) {
|
|
15
27
|
// rn 单位 dp = 1(css)px = 1 物理像素 * pixelRatio(像素比)
|
|
@@ -73,17 +73,20 @@ export default function createApp (options) {
|
|
|
73
73
|
children
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
|
+
const getComponent = () => {
|
|
77
|
+
return item.displayName ? item : item()
|
|
78
|
+
}
|
|
76
79
|
if (key === initialRouteName) {
|
|
77
80
|
return createElement(Stack.Screen, {
|
|
78
81
|
name: key,
|
|
79
|
-
getComponent
|
|
82
|
+
getComponent,
|
|
80
83
|
initialParams,
|
|
81
84
|
layout: headerLayout
|
|
82
85
|
})
|
|
83
86
|
}
|
|
84
87
|
return createElement(Stack.Screen, {
|
|
85
88
|
name: key,
|
|
86
|
-
getComponent
|
|
89
|
+
getComponent,
|
|
87
90
|
layout: headerLayout
|
|
88
91
|
})
|
|
89
92
|
})
|
|
@@ -53,8 +53,8 @@ function createEffect (proxy, componentsMap) {
|
|
|
53
53
|
const appComponentsMap = global.__appComponentsMap || {}
|
|
54
54
|
const generichash = proxy.target.generichash || ''
|
|
55
55
|
const genericComponentsMap = global.__mpxGenericsMap?.[generichash] || {}
|
|
56
|
-
const
|
|
57
|
-
return
|
|
56
|
+
const component = componentsMap[tagName] || genericComponentsMap[tagName] || appComponentsMap[tagName]
|
|
57
|
+
return component ? component.displayName ? component : component() : getByPath(ReactNative, tagName)
|
|
58
58
|
}
|
|
59
59
|
const innerCreateElement = (type, ...rest) => {
|
|
60
60
|
if (!type) return null
|