@aks-dev/easyui 1.0.49 → 1.0.52

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
  }
@@ -1,4 +1,4 @@
1
- package com.utils;
1
+ package com.easyui.utils;
2
2
 
3
3
  import android.os.Build;
4
4
  import android.text.TextUtils;
@@ -0,0 +1,30 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-19 10:23:01
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-31 17:26:16
6
+ * @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
7
+ */
8
+
9
+ import { Dimensions, NativeModules, Platform } from 'react-native';
10
+
11
+ const { RNEasyui } = NativeModules;
12
+
13
+
14
+
15
+
16
+ export const getStatusBarHeight = () => {
17
+ if (Platform.OS == 'android') return RNEasyui.getStatusBarHeight();
18
+
19
+ const deviceHeight = Dimensions.get('window').height;
20
+ const isiPhoneX = Platform.OS == 'ios' && (deviceHeight > 736)
21
+ if (isiPhoneX) return Promise.resolve(44)
22
+ }
23
+
24
+ export const getNavigationBarHeight = () => {
25
+ if (Platform.OS == 'android') return RNEasyui.getNavigationBarHeight();
26
+ const deviceHeight = Dimensions.get('window').height;
27
+ const isiPhoneX = Platform.OS == 'ios' && (deviceHeight > 736)
28
+ if (isiPhoneX) return Promise.resolve(88)
29
+ return Promise.resolve(64)
30
+ }
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.49",
3
+ "version": "1.0.52",
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:19:03
6
+ * @FilePath: /@aks-dev/easyui/screen/index.ts
7
7
  */
8
8
  export declare const deviceWidth: number; //设备的宽度
9
9
  export declare const deviceHeight: number; //设备的高度
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-15 14:15:07
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-04-26 14:39:27
6
- * @FilePath: /@aks/easy/screen/text-set.tsx
5
+ * @LastEditTime: 2022-05-31 17:25:13
6
+ * @FilePath: /@aks-dev/easyui/screen/init-fit.tsx
7
7
  */
8
8
  /**
9
9
  * 全局配置Text
@@ -55,4 +55,13 @@ TextInput.render = function (...args: any[]) {
55
55
  if (!Text.defaultProps) Text.defaultProps = {};
56
56
  if (!TextInput.defaultProps) TextInput.defaultProps = {};
57
57
  Text.defaultProps.allowFontScaling = false
58
- TextInput.defaultProps.allowFontScaling = false
58
+ TextInput.defaultProps.allowFontScaling = false
59
+
60
+
61
+
62
+ import * as RNEasyui from '../jsbridge/RNEasyui';
63
+
64
+
65
+ export const statusBarHeight = await RNEasyui.getStatusBarHeight()
66
+
67
+ export const navigationBarHeight = await RNEasyui.getNavigationBarHeight()
package/screen/px2dp.tsx CHANGED
@@ -2,10 +2,10 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-18 14:32:25
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-05-16 17:46:40
6
- * @FilePath: /@aks/easyui/screen/px2dp.tsx
5
+ * @LastEditTime: 2022-05-31 17:22:42
6
+ * @FilePath: /@aks-dev/easyui/screen/px2dp.tsx
7
7
  */
8
- import { Dimensions, StatusBar, Platform } from 'react-native';
8
+ import { Dimensions, Platform } from 'react-native';
9
9
 
10
10
 
11
11
  // 设备宽度,单位 dp
@@ -13,6 +13,7 @@ export const deviceWidth = Dimensions.get('window').width; //设备的宽
13
13
  export const deviceHeight = Dimensions.get('window').height; //设备的高度
14
14
  export const isAndroid = Platform.OS === "android"
15
15
  export const isIos = Platform.OS === 'ios'
16
+ export const isiPhoneX = isIos && (deviceHeight > 736)
16
17
 
17
18
  /**
18
19
  * 375px/667px
@@ -32,20 +33,21 @@ export const px2dp = (uiElePx: number) => {
32
33
 
33
34
 
34
35
 
35
- export const isiPhoneX = isIos && (deviceHeight > 736)
36
36
 
37
37
 
38
+ // export const statusBarHeight = (() => {
39
+ // if (isAndroid) {
40
+ // if ((StatusBar.currentHeight || 0) > 20) return 40
41
+ // }
42
+ // if (isiPhoneX) return 44
43
+ // return 20
44
+ // })()
45
+
46
+ // export const navigationBarHeight = (() => {
47
+ // if (isAndroid) return statusBarHeight + 44
48
+ // if (isiPhoneX) return 88
49
+ // return 64
50
+ // })()
51
+
38
52
 
39
- export const statusBarHeight = (() => {
40
- if (isAndroid) {
41
- if ((StatusBar.currentHeight || 0) > 20) return 40
42
- }
43
- if (isiPhoneX) return 44
44
- return 20
45
- })()
46
53
 
47
- export const navigationBarHeight = (() => {
48
- if (isAndroid) return statusBarHeight + 44
49
- if (isiPhoneX) return 88
50
- return 64
51
- })()
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * @Author: shiguo
4
4
  * @Date: 2022-04-13 12:47:34
5
5
  * @LastEditors: shiguo
6
- * @LastEditTime: 2022-05-16 15:19:39
7
- * @FilePath: /@aks/easyui/src/index.ts
6
+ * @LastEditTime: 2022-05-31 17:24:37
7
+ * @FilePath: /@aks-dev/easyui/src/index.ts
8
8
  */
9
9
 
10
10
 
@@ -53,6 +53,7 @@ export type { EchartsViewProps } from '../lib/Echarts'
53
53
  /// 全局适配
54
54
  export * from '../screen/px2dp'
55
55
  export * from '../screen/px2sp'
56
+ export * from '../screen/init-fit'
56
57
 
57
58
 
58
59
  /// 工具
@@ -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;