@tarojs/taro-rn 3.7.0-beta.1 → 3.7.0-beta.4

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.
@@ -1,4 +1,4 @@
1
- import { Platform, Dimensions, PixelRatio } from 'react-native';
1
+ import { Platform, Dimensions, PixelRatio, StatusBar } from 'react-native';
2
2
  import { initialWindowMetrics } from 'react-native-safe-area-context';
3
3
  import DeviceInfo from 'react-native-device-info';
4
4
  export function getSystemInfoSync() {
@@ -17,7 +17,12 @@ export function getSystemInfoSync() {
17
17
  const deviceOrientation = screenHeight > screenWidth ? 'portrait' : 'landscape';
18
18
  // NOTE:在竖屏正方向下的安全区域
19
19
  let safeArea = {};
20
- const { top = 0, bottom = 0 } = (initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets) || {};
20
+ let { top = 0, bottom = 0 } = (initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets) || {};
21
+ // NOTE:android 在沉浸式切换时,有几率top值为0。
22
+ // https://github.com/th3rdwave/react-native-safe-area-context/issues/364
23
+ if (Platform.OS === 'android') {
24
+ top = StatusBar.currentHeight || 0;
25
+ }
21
26
  try {
22
27
  const W = Math.min(screenWidth, screenHeight);
23
28
  const H = Math.max(screenWidth, screenHeight);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/getSystemInfoSync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACX,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,UAAU,MAAM,0BAA0B,CAAA;AAEjD,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAQ,EAAE,CAAA;IAEnB,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;IACnC,MAAM,KAAK,GAAG,UAAU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index.js",
6
6
  "typings": "types/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "react-native-safe-area-context": "~4.5.0",
49
49
  "react-native-stylekit": "^1.0.0",
50
50
  "react-native-syan-image-picker": "0.5.3",
51
- "@tarojs/runtime-rn": "3.7.0-beta.1"
51
+ "@tarojs/runtime-rn": "3.7.0-beta.4"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@babel/core": "^7.14.5",
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "scripts": {
93
93
  "assets": "cpy 'src/**/*.png' '!src/__tests__/*' dist",
94
- "build": "rimraf ./dist && tsc && pnpm run assets && pnpm run script",
94
+ "build": "rimraf --impl=move-remove ./dist && tsc && pnpm run assets && pnpm run script",
95
95
  "dev": "pnpm run assets && tsc --watch",
96
96
  "lint": "eslint .",
97
97
  "test": "jest --silent",
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  Platform,
3
3
  Dimensions,
4
- PixelRatio
4
+ PixelRatio,
5
+ StatusBar
5
6
  } from 'react-native'
6
7
  import { initialWindowMetrics } from 'react-native-safe-area-context'
7
8
  import DeviceInfo from 'react-native-device-info'
@@ -24,7 +25,11 @@ export function getSystemInfoSync(): Taro.getSystemInfoSync.Result {
24
25
 
25
26
  // NOTE:在竖屏正方向下的安全区域
26
27
  let safeArea = {}
27
- const { top = 0, bottom = 0 } = initialWindowMetrics?.insets || {}
28
+ let { top = 0, bottom = 0 } = initialWindowMetrics?.insets || {}
29
+ // NOTE:android 在沉浸式切换时,有几率top值为0。
30
+ // https://github.com/th3rdwave/react-native-safe-area-context/issues/364
31
+ if(Platform.OS === 'android') { top = StatusBar.currentHeight || 0; }
32
+
28
33
  try {
29
34
  const W = Math.min(screenWidth, screenHeight)
30
35
  const H = Math.max(screenWidth, screenHeight)
@@ -1,9 +1,9 @@
1
1
  import Taro from '@tarojs/taro'
2
2
 
3
3
  declare module '@tarojs/taro' {
4
- namespace vibrateShort {
5
- interface Option {
6
- type?: 'heavy' | 'medium' | 'light'
7
- }
8
- }
4
+ // namespace vibrateShort {
5
+ // interface Option {
6
+ // type?: 'heavy' | 'medium' | 'light'
7
+ // }
8
+ // }
9
9
  }