@mpxjs/core 2.10.14-beta.1 → 2.10.14-beta.13
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 +7 -0
- package/package.json +1 -1
- package/src/platform/createApp.ios.js +7 -20
package/@types/index.d.ts
CHANGED
|
@@ -381,6 +381,13 @@ export interface RnConfig {
|
|
|
381
381
|
* @param packages 分包名数组
|
|
382
382
|
*/
|
|
383
383
|
downloadChunkAsync?: (packages: Array<string>) => void;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* bundle 中是否关闭 android 键盘避让功能,如果关闭需要将该配置设置为 false,使用 mpx 内置的键盘避让逻辑
|
|
387
|
+
* @platform android
|
|
388
|
+
* @default true
|
|
389
|
+
*/
|
|
390
|
+
enableNativeKeyboardAvoiding?: boolean
|
|
384
391
|
}
|
|
385
392
|
|
|
386
393
|
interface MpxConfig {
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { createElement, memo, useRef, useEffect } from 'react'
|
|
|
10
10
|
import * as ReactNative from 'react-native'
|
|
11
11
|
import { initAppProvides } from './export/inject'
|
|
12
12
|
import { NavigationContainer, createNativeStackNavigator, SafeAreaProvider, GestureHandlerRootView } from './env/navigationHelper'
|
|
13
|
-
import
|
|
13
|
+
import MpxNav from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/nav'
|
|
14
14
|
import { NavSharedProvider } from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-nav-container'
|
|
15
15
|
|
|
16
16
|
const appHooksMap = makeMap(mergeLifecycle(LIFECYCLE).app)
|
|
@@ -34,15 +34,6 @@ function filterOptions (options, appData) {
|
|
|
34
34
|
return newOptions
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
let CachedMpxNav = null
|
|
38
|
-
|
|
39
|
-
function getMpxNav() {
|
|
40
|
-
// Mpx toplevel 执行时获取不到
|
|
41
|
-
return (CachedMpxNav ??= createMpxNav({
|
|
42
|
-
Mpx
|
|
43
|
-
}))
|
|
44
|
-
}
|
|
45
|
-
|
|
46
37
|
export default function createApp (options) {
|
|
47
38
|
const appData = {}
|
|
48
39
|
// app选项目前不需要进行转换
|
|
@@ -76,7 +67,7 @@ export default function createApp (options) {
|
|
|
76
67
|
flex: 1
|
|
77
68
|
}
|
|
78
69
|
},
|
|
79
|
-
createElement(
|
|
70
|
+
createElement(MpxNav, {
|
|
80
71
|
pageConfig: pageConfig,
|
|
81
72
|
navigation
|
|
82
73
|
}),
|
|
@@ -118,7 +109,7 @@ export default function createApp (options) {
|
|
|
118
109
|
}
|
|
119
110
|
}
|
|
120
111
|
const appState = reactive({ state: '' })
|
|
121
|
-
// TODO
|
|
112
|
+
// TODO reason 目前支持模拟 0/3
|
|
122
113
|
// 0用户退出小程序
|
|
123
114
|
// 1进入其他小程序
|
|
124
115
|
// 2打开原生功能页
|
|
@@ -146,12 +137,10 @@ export default function createApp (options) {
|
|
|
146
137
|
global.__mpxAppCbs.show.forEach((cb) => {
|
|
147
138
|
cb(options)
|
|
148
139
|
})
|
|
149
|
-
} else if (value === 'hide') {
|
|
150
|
-
|
|
151
|
-
delete appState.hideReason
|
|
152
|
-
global.__mpxAppCbs.hide.forEach((cb) => {
|
|
140
|
+
} else if (value === 'hide' || value === 'exit') {
|
|
141
|
+
global.__mpxAppCbs.hide.forEach((cb) => {
|
|
153
142
|
cb({
|
|
154
|
-
reason
|
|
143
|
+
reason: value === 'exit' ? 0 : 3
|
|
155
144
|
})
|
|
156
145
|
})
|
|
157
146
|
}
|
|
@@ -164,7 +153,6 @@ export default function createApp (options) {
|
|
|
164
153
|
global.__mpxPageStatusMap[navigation.pageId] = 'show'
|
|
165
154
|
}
|
|
166
155
|
} else if (currentState === 'inactive' || currentState === 'background') {
|
|
167
|
-
appState.hideReason = 3
|
|
168
156
|
appState.state = 'hide'
|
|
169
157
|
if (navigation && hasOwn(global.__mpxPageStatusMap, navigation.pageId)) {
|
|
170
158
|
global.__mpxPageStatusMap[navigation.pageId] = 'hide'
|
|
@@ -234,8 +222,7 @@ export default function createApp (options) {
|
|
|
234
222
|
}
|
|
235
223
|
})
|
|
236
224
|
return () => {
|
|
237
|
-
appState.
|
|
238
|
-
appState.state = 'hide'
|
|
225
|
+
appState.state = 'exit'
|
|
239
226
|
changeSubscription && changeSubscription.remove()
|
|
240
227
|
resizeSubScription && resizeSubScription.remove()
|
|
241
228
|
}
|