@mpxjs/core 2.10.14-beta.13 → 2.10.14-beta.15

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.14-beta.13",
3
+ "version": "2.10.14-beta.15",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -1,7 +1,7 @@
1
1
  import { createNativeStackNavigator } from '@react-navigation/native-stack'
2
2
  import { NavigationContainer, StackActions } from '@react-navigation/native'
3
3
  import PortalHost from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-portal/portal-host'
4
- import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context'
4
+ import { SafeAreaProvider, useSafeAreaInsets, initialWindowMetrics } from 'react-native-safe-area-context'
5
5
  import { GestureHandlerRootView } from 'react-native-gesture-handler'
6
6
 
7
7
  export {
@@ -11,5 +11,6 @@ export {
11
11
  GestureHandlerRootView,
12
12
  PortalHost,
13
13
  SafeAreaProvider,
14
- useSafeAreaInsets
14
+ useSafeAreaInsets,
15
+ initialWindowMetrics
15
16
  }
@@ -15,7 +15,7 @@ import {
15
15
  KeyboardAvoidContext,
16
16
  RouteContext
17
17
  } from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/context'
18
- import { PortalHost, useSafeAreaInsets } from '../env/navigationHelper'
18
+ import { PortalHost, useSafeAreaInsets, initialWindowMetrics } from '../env/navigationHelper'
19
19
  import { useInnerHeaderHeight } from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/nav'
20
20
 
21
21
  const ProviderContext = createContext(null)
@@ -420,6 +420,11 @@ function usePageStatus (navigation, pageId) {
420
420
  set(pageStatusMap, pageId, '')
421
421
  }
422
422
  useEffect(() => {
423
+ if (navigation.isFocused && navigation.isFocused()) {
424
+ Promise.resolve().then(() => {
425
+ pageStatusMap[pageId] = 'show'
426
+ })
427
+ }
423
428
  const focusSubscription = navigation.addListener('focus', () => {
424
429
  pageStatusMap[pageId] = 'show'
425
430
  })
@@ -481,7 +486,17 @@ function getLayoutData (headerHeight) {
481
486
  // 在横屏状态下 screen.height = window.height + bottomVirtualHeight
482
487
  // 在正常状态 screen.height = window.height + bottomVirtualHeight + statusBarHeight
483
488
  const isLandscape = screenDimensions.height < screenDimensions.width
484
- const bottomVirtualHeight = isLandscape ? screenDimensions.height - windowDimensions.height : ((screenDimensions.height - windowDimensions.height - ReactNative.StatusBar.currentHeight) || 0)
489
+ // const bottomVirtualHeight = isLandscape ? screenDimensions.height - windowDimensions.height : ((screenDimensions.height - windowDimensions.height - ReactNative.StatusBar.currentHeight) || 0)
490
+ let bottomVirtualHeight = 0
491
+ // 红米手机&魅族16T手机的screen.height = windowHeight + bottomVirtualHeight 导致计算出来的底部虚拟偏少。此部分端引擎同学进行修改中
492
+ // mpx临时兼容 bottomVirtualHeight取 initialWindowMetrics.inset.bottom 和 反算出来的bottomVirtualHeight的更大的值
493
+ if (ReactNative.Platform.OS === 'android') {
494
+ if (isLandscape) {
495
+ bottomVirtualHeight = screenDimensions.height - windowDimensions.height
496
+ } else {
497
+ bottomVirtualHeight = Math.max(screenDimensions.height - windowDimensions.height - ReactNative.StatusBar.currentHeight, initialWindowMetrics?.insets?.bottom || 0, 0)
498
+ }
499
+ }
485
500
  return {
486
501
  left: 0,
487
502
  top: headerHeight,