@mpxjs/core 2.10.24-beta.1 → 2.10.24-test.1

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/@types/index.d.ts CHANGED
@@ -294,13 +294,6 @@ export interface RnConfig {
294
294
  */
295
295
  onStateChange?: (state: Record<string, any>) => void
296
296
 
297
- /**
298
- * 自定义 React Navigation Stack.Navigator 的 screenOptions。
299
- *
300
- * 会与 Mpx 默认 screenOptions 合并,用户配置优先。
301
- */
302
- screenOptions?: Record<string, any>
303
-
304
297
  /**
305
298
  * 用于获取初始路由配置的函数。
306
299
  *
@@ -327,13 +320,6 @@ export interface RnConfig {
327
320
  */
328
321
  disableAppStateListener?: boolean
329
322
 
330
- /**
331
- * Stack screenOptions 中 statusBarTranslucent 的默认值。
332
- *
333
- * @default true
334
- */
335
- statusBarTranslucent?: boolean
336
-
337
323
  /**
338
324
  * RN 文本类组件是否允许跟随系统字体缩放。
339
325
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.10.24-beta.1",
3
+ "version": "2.10.24-test.1",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
package/src/core/proxy.js CHANGED
@@ -54,6 +54,7 @@ import {
54
54
  import contextMap from '../dynamic/vnode/context'
55
55
  import { getAst } from '../dynamic/astCache'
56
56
  import { inject, provide } from '../platform/export/inject'
57
+ import * as perf from '@mpxjs/perf'
57
58
 
58
59
  let uid = 0
59
60
 
@@ -166,6 +167,8 @@ export default class MpxProxy {
166
167
  }
167
168
 
168
169
  created () {
170
+ let perfId = -1
171
+ if (__mpx_perf_framework__) perfId = perf.scopeStart('proxy:created')
169
172
  if (__mpx_dynamic_runtime__) {
170
173
  // 缓存上下文,在 destoryed 阶段删除
171
174
  contextMap.set(this.uid, this.target)
@@ -199,6 +202,7 @@ export default class MpxProxy {
199
202
  if (this.reCreated) {
200
203
  nextTick(this.mounted.bind(this))
201
204
  }
205
+ if (__mpx_perf_framework__) perf.scopeEnd(perfId)
202
206
  }
203
207
 
204
208
  resolveParent () {
@@ -248,6 +252,8 @@ export default class MpxProxy {
248
252
  }
249
253
 
250
254
  unmounted () {
255
+ let perfId = -1
256
+ if (__mpx_perf_framework__) perfId = perf.scopeStart('proxy:unmounted')
251
257
  if (__mpx_dynamic_runtime__) {
252
258
  // 页面/组件销毁清除上下文的缓存
253
259
  contextMap.remove(this.uid)
@@ -277,6 +283,7 @@ export default class MpxProxy {
277
283
  this.miniRenderData = null
278
284
  this.forceUpdateData = null
279
285
  }
286
+ if (__mpx_perf_framework__) perf.scopeEnd(perfId)
280
287
  }
281
288
 
282
289
  isUnmounted () {
@@ -80,6 +80,8 @@ const unit = {
80
80
 
81
81
  const empty = {}
82
82
 
83
+ const isNum = (v) => !isNaN(+v)
84
+
83
85
  function formatValue (value, unitType) {
84
86
  if (!dimensionsInfoInitialized) useDimensionsInfo(global.__mpxAppDimensionsInfo)
85
87
  if (unitType && typeof unit[unitType] === 'function') {
@@ -170,7 +172,7 @@ function stringifyDynamicClass (value) {
170
172
 
171
173
  const listDelimiter = /;(?![^(]*[)])/g
172
174
  const propertyDelimiter = /:(.+)/
173
- const unitRegExp = /^\s*(-?\d+(?:\.\d+)?)(rpx|vw|vh|px)?\s*$/
175
+ const unitRegExp = /^\s*(-?(?:\d+(?:\.\d+)?|\.\d+))(rpx|vw|vh|px)?\s*$/
174
176
  const varRegExp = /^--/
175
177
 
176
178
  const parseStyleText = cached((cssText) => {
@@ -213,7 +215,17 @@ function mergeObjectArray (arr) {
213
215
  function transformStyleObj (styleObj) {
214
216
  const transformed = {}
215
217
  Object.keys(styleObj).forEach((prop) => {
216
- transformed[prop] = formatValue(styleObj[prop])
218
+ if (prop === 'lineHeight' && isNum(styleObj[prop])) {
219
+ if (+styleObj[prop] === 0) {
220
+ transformed[prop] = 0
221
+ } else {
222
+ transformed[prop] = `${Math.round(styleObj[prop] * 100)}%`
223
+ }
224
+ } else if (prop === 'flex') {
225
+ transformed[prop] = styleObj[prop]
226
+ } else {
227
+ transformed[prop] = formatValue(styleObj[prop])
228
+ }
217
229
  })
218
230
  return transformed
219
231
  }
@@ -133,7 +133,7 @@ export default function createApp (options) {
133
133
  cb(options)
134
134
  })
135
135
  } else if (value === 'hide' || value === 'exit') {
136
- global.__mpxAppCbs.hide.forEach((cb) => {
136
+ global.__mpxAppCbs.hide.forEach((cb) => {
137
137
  cb({
138
138
  reason: value === 'exit' ? 0 : 3
139
139
  })
@@ -211,11 +211,11 @@ export default function createApp (options) {
211
211
  }, [])
212
212
 
213
213
  const { initialRouteName, initialParams } = initialRouteRef.current
214
- const navScreenOpts = Object.assign({
214
+ const navScreenOpts = {
215
215
  headerShown: false,
216
216
  statusBarTranslucent: Mpx.config.rnConfig.statusBarTranslucent ?? true,
217
217
  statusBarBackgroundColor: 'transparent'
218
- }, Mpx.config.rnConfig.screenOptions)
218
+ }
219
219
 
220
220
  return createElement(SafeAreaProvider,
221
221
  null,