@aks-dev/easyui 1.0.50 → 1.0.51

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.
@@ -2,12 +2,13 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-25 17:57:29
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-04-27 09:18:14
6
- * @FilePath: /easy/android/src/main/java/com/easyui/RNEasyuiModule.java
5
+ * @LastEditTime: 2022-05-31 17:04:47
6
+ * @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/RNEasyuiModule.java
7
7
  */
8
8
 
9
9
  package com.easyui;
10
10
 
11
+ import com.facebook.react.bridge.Promise;
11
12
  import com.facebook.react.bridge.ReactApplicationContext;
12
13
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
13
14
  import com.facebook.react.bridge.ReactMethod;
@@ -15,15 +16,30 @@ import com.facebook.react.bridge.Callback;
15
16
 
16
17
  public class RNEasyuiModule extends ReactContextBaseJavaModule {
17
18
 
18
- private final ReactApplicationContext reactContext;
19
+ private final ReactApplicationContext context;
19
20
 
20
21
  public RNEasyuiModule(ReactApplicationContext reactContext) {
21
22
  super(reactContext);
22
- this.reactContext = reactContext;
23
+ this.context = reactContext;
23
24
  }
24
25
 
25
26
  @Override
26
27
  public String getName() {
27
28
  return "RNEasyui";
28
29
  }
30
+
31
+ @ReactMethod
32
+ public void getStatusBarHeight(final Promise promise){
33
+
34
+ int status_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("status_bar_height", "dimen", "android"));
35
+ promise.resolve(status_bar_height);
36
+ }
37
+
38
+ @ReactMethod
39
+ public void getNavigationBarHeight(final Promise promise){
40
+
41
+ int navigation_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("navigation_bar_height", "dimen", "android"));
42
+ promise.resolve(navigation_bar_height);
43
+ }
44
+
29
45
  }
@@ -0,0 +1,33 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:23:01
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-31 17:06:10
6
+ * @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.tsx
7
+ */
8
+
9
+ import { NativeModules, Platform, StatusBar, Dimensions } from 'react-native';
10
+
11
+ const { RNEasyui } = NativeModules;
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ const getStatusBarHeight = () => {
20
+ if (Platform.OS == 'android') return RNEasyui.getStatusBarHeight();
21
+
22
+ const deviceHeight = Dimensions.get('window').height;
23
+ const isiPhoneX = Platform.OS == 'ios' && (deviceHeight > 736)
24
+ if (isiPhoneX) return Promise.resolve(44)
25
+ }
26
+
27
+ const getNavigationBarHeight = () => {
28
+ if (Platform.OS == 'android') return RNEasyui.getNavigationBarHeight();
29
+ const deviceHeight = Dimensions.get('window').height;
30
+ const isiPhoneX = Platform.OS == 'ios' && (deviceHeight > 736)
31
+ if (isiPhoneX) return Promise.resolve(88)
32
+ return Promise.resolve(64)
33
+ }
File without changes
package/jsbridge/index.ts CHANGED
@@ -2,9 +2,11 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-19 10:23:01
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-24 14:08:39
5
+ * @LastEditTime: 2022-05-31 17:00:25
6
6
  * @FilePath: /@aks-dev/easyui/jsbridge/index.ts
7
- */
7
+ */
8
+
9
+
8
10
  /**
9
11
  * @description: 获取App版本号
10
12
  * @param {*}
@@ -25,4 +27,18 @@
25
27
  * @description: app升级
26
28
  * @return {*}
27
29
  */
28
- export declare const upgrade: (options: UpgradeOptions) => Promise<string>;
30
+ export declare const upgrade: (options: UpgradeOptions) => Promise<string>;
31
+
32
+
33
+
34
+ /**
35
+ * @description: 获取status_bar_height
36
+ * @return {*}
37
+ */
38
+ export declare const getStatusBarHeight:()=>Promise<number>;
39
+
40
+ /**
41
+ * @description: 获取navigation_bar_height
42
+ * @return {*}
43
+ */
44
+ export declare const getNavigationBarHeight:()=>Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "description": "爱科森开发工具包(react-native)",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",
package/screen/index.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-19 10:25:14
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-16 17:58:40
6
- * @FilePath: /@aks/easyui/screen/index.ts
5
+ * @LastEditTime: 2022-05-31 17:09:47
6
+ * @FilePath: /@aks-dev/easyui/screen/index.ts
7
7
  */
8
8
  export declare const deviceWidth: number; //设备的宽度
9
9
  export declare const deviceHeight: number; //设备的高度
@@ -13,12 +13,14 @@ export declare const px2dp: (uiElePx: number) => number;
13
13
  export declare const px2sp: (fontSize: number) => number;
14
14
  export declare const isiPhoneX: boolean;
15
15
  /**
16
+ * @deprecated 已废弃,请从jsbridge.getStatusBarHeight()获取
16
17
  * @description: 状态栏的高度
17
18
  * @param {*}
18
19
  * @return {*}
19
20
  */
20
21
  export declare const statusBarHeight: number;
21
22
  /**
23
+ * @deprecated 已废弃,请从jsbridge.getNavigationBarHeight()获取
22
24
  * @description: 顶部导航条的高度
23
25
  * @param {*}
24
26
  * @return {*}
@@ -1,13 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-19 10:23:01
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-04-27 09:22:46
6
- * @FilePath: /easy/jsbridge/index.ts
7
- */
8
-
9
- import { NativeModules } from 'react-native';
10
-
11
- const { RNEasyui } = NativeModules;
12
-
13
- export default RNEasyui;