@mpxjs/core 2.9.41-react.0 → 2.9.41

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.9.41-react.0",
3
+ "version": "2.9.41",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -19,18 +19,18 @@
19
19
  ],
20
20
  "main": "src/index.js",
21
21
  "dependencies": {
22
- "@mpxjs/utils": "^2.9.41-react.0",
22
+ "@mpxjs/utils": "^2.9.41",
23
23
  "lodash": "^4.1.1",
24
24
  "miniprogram-api-typings": "^3.10.0"
25
25
  },
26
26
  "peerDependencies": {
27
+ "@ant-design/react-native": "^5.1.3",
27
28
  "@mpxjs/api-proxy": "^2.9.0",
28
29
  "@mpxjs/store": "^2.9.0",
29
30
  "@react-navigation/native": "^6.1.17",
30
31
  "@react-navigation/native-stack": "^6.9.26",
31
32
  "react": "^18.3.1",
32
33
  "react-native": "^0.74.3",
33
- "react-native-root-siblings": "^5.0.1",
34
34
  "vue": "^2.7.10",
35
35
  "vue-demi": "^0.14.6",
36
36
  "vue-i18n": "^8.27.2",
@@ -61,7 +61,7 @@
61
61
  "@react-navigation/native-stack": {
62
62
  "optional": true
63
63
  },
64
- "react-native-root-siblings": {
64
+ "@ant-design/react-native": {
65
65
  "optional": true
66
66
  }
67
67
  },
@@ -81,5 +81,5 @@
81
81
  "url": "https://github.com/didi/mpx/issues"
82
82
  },
83
83
  "sideEffects": false,
84
- "gitHead": "1c9ae7527a257fad98f5536114e63415cea54271"
84
+ "gitHead": "0b3ee5d2c1b6c6e0af6a842eb4e12f4a1173c067"
85
85
  }
@@ -40,7 +40,7 @@ function stringifyDynamicClass (value) {
40
40
  }
41
41
 
42
42
  const listDelimiter = /;(?![^(]*[)])/g
43
- const propertyDelimiter = /':(.+)'/
43
+ const propertyDelimiter = /:(.+)/
44
44
  const rpxRegExp = /^\s*(\d+(\.\d+)?)rpx\s*$/
45
45
  const pxRegExp = /^\s*(\d+(\.\d+)?)(px)?\s*$/
46
46
 
@@ -81,6 +81,7 @@ export default function createApp (option, config = {}) {
81
81
  referrerInfo: {}
82
82
  }
83
83
  global.__mpxEnterOptions = options
84
+ // todo relaunch时会重复执行,需check
84
85
  defaultOptions.onLaunch && defaultOptions.onLaunch.call(instance, options)
85
86
  }, [])
86
87
  return createElement(NavigationContainer,
@@ -1,4 +1,4 @@
1
- import { useEffect, useSyncExternalStore, useRef, createElement, memo, forwardRef, useImperativeHandle } from 'react'
1
+ import { useEffect, useLayoutEffect, useSyncExternalStore, useRef, createElement, memo, forwardRef, useImperativeHandle } from 'react'
2
2
  import * as ReactNative from 'react-native'
3
3
  import { ReactiveEffect } from '../../../observer/effect'
4
4
  import { hasOwn, isFunction, noop, isObject, error, getByPath, collectDataset } from '@mpxjs/utils'
@@ -7,10 +7,6 @@ import { BEFOREUPDATE, UPDATED } from '../../../core/innerLifecycle'
7
7
  import mergeOptions from '../../../core/mergeOptions'
8
8
  import { queueJob } from '../../../observer/scheduler'
9
9
 
10
- function getNativeComponent (tagName) {
11
- return getByPath(ReactNative, tagName)
12
- }
13
-
14
10
  function getRootProps (props) {
15
11
  const rootProps = {}
16
12
  for (const key in props) {
@@ -39,8 +35,11 @@ function createEffect (proxy, components, props) {
39
35
  proxy.onStoreChange && proxy.onStoreChange()
40
36
  }
41
37
  update.id = proxy.uid
38
+ const getComponent = (tagName) => {
39
+ return components[tagName] || getByPath(ReactNative, tagName)
40
+ }
42
41
  proxy.effect = new ReactiveEffect(() => {
43
- return proxy.target.__injectedRender(createElement, components, getNativeComponent, getRootProps(props))
42
+ return proxy.target.__injectedRender(createElement, getComponent, getRootProps(props))
44
43
  }, () => queueJob(update), proxy.scope)
45
44
  }
46
45
 
@@ -198,8 +197,7 @@ function createInstance ({ propsRef, ref, type, rawOptions, currentInject, valid
198
197
 
199
198
  export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
200
199
  rawOptions = mergeOptions(rawOptions, type, false)
201
- const { RootSiblingParent } = global.__navigationHelper
202
- const components = currentInject.getComponents() || {}
200
+ const components = Object.assign({}, rawOptions.components, currentInject.getComponents())
203
201
  const validProps = Object.assign({}, rawOptions.props, rawOptions.properties)
204
202
  const defaultOptions = memo(forwardRef((props, ref) => {
205
203
  const instanceRef = useRef(null)
@@ -249,13 +247,25 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
249
247
  }))
250
248
 
251
249
  if (type === 'page') {
252
- const Page = () => {
253
- return createElement(RootSiblingParent,
250
+ const { Provider } = global.__navigationHelper
251
+ const pageConfig = Object.assign({}, global.__mpxPageConfig, currentInject.pageConfig)
252
+ const Page = ({ navigation }) => {
253
+ useLayoutEffect(() => {
254
+ navigation.setOptions({
255
+ headerTitle: pageConfig.navigationBarTitleText || '',
256
+ headerStyle: {
257
+ backgroundColor: pageConfig.navigationBarBackgroundColor || '#000000'
258
+ },
259
+ headerTintColor: pageConfig.navigationBarTextStyle || 'white'
260
+ })
261
+ }, [])
262
+ return createElement(Provider,
254
263
  null,
255
264
  createElement(ReactNative.ScrollView,
256
265
  {
257
266
  style: {
258
- ...ReactNative.StyleSheet.absoluteFillObject
267
+ ...ReactNative.StyleSheet.absoluteFillObject,
268
+ backgroundColor: pageConfig.backgroundColor || '#ffffff'
259
269
  },
260
270
  showsVerticalScrollIndicator: false
261
271
  },