@aks-dev/easyui 1.0.51 → 1.0.54
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/android/src/main/java/com/easyui/RNEasyuiModule.java +43 -26
- package/android/src/main/java/com/easyui/utils/ScreenUtil.java +17 -0
- package/jsbridge/RNEasyui.ts +5 -8
- package/jsbridge/index.ts +33 -32
- package/package.json +1 -1
- package/screen/index.ts +2 -4
- package/screen/{text-set.tsx → init-fit.tsx} +7 -3
- package/screen/{px2dp.tsx → px2dp.ts} +19 -9
- package/screen/{px2sp.tsx → px2sp.ts} +0 -0
- package/src/index.ts +2 -3
- /package/utils/{lazy.tsx → lazy.ts} +0 -0
- /package/utils/{mode.tsx → mode.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-25 17:57:29
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-31
|
|
5
|
+
* @LastEditTime: 2022-05-31 18:19:20
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/RNEasyuiModule.java
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -12,34 +12,51 @@ import com.facebook.react.bridge.Promise;
|
|
|
12
12
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
13
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
14
|
import com.facebook.react.bridge.ReactMethod;
|
|
15
|
-
import com.facebook.react.bridge.Callback;
|
|
16
15
|
|
|
17
16
|
public class RNEasyuiModule extends ReactContextBaseJavaModule {
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
private final ReactApplicationContext context;
|
|
19
|
+
|
|
20
|
+
public RNEasyuiModule(ReactApplicationContext reactContext) {
|
|
21
|
+
super(reactContext);
|
|
22
|
+
this.context = reactContext;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public String getName() {
|
|
27
|
+
return "RNEasyui";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ReactMethod
|
|
31
|
+
public void getStatusBarHeight(final Promise promise) {
|
|
32
|
+
|
|
33
|
+
// int status_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("status_bar_height", "dimen", "android"));
|
|
34
|
+
// promise.resolve(status_bar_height);
|
|
35
|
+
int result = 0;
|
|
36
|
+
int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
|
37
|
+
if (resId > 0) {
|
|
38
|
+
result = context.getResources().getDimensionPixelSize(resId);
|
|
39
|
+
}
|
|
40
|
+
promise.resolve(result);
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
public void getNavigationBarHeight(final Promise promise) {
|
|
46
|
+
|
|
47
|
+
// int navigation_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("navigation_bar_height", "dimen", "android"));
|
|
48
|
+
// promise.resolve(navigation_bar_height);
|
|
49
|
+
|
|
50
|
+
int resourceId = 0;
|
|
51
|
+
int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
|
52
|
+
if (rid != 0) {
|
|
53
|
+
resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
|
54
|
+
int result = context.getResources().getDimensionPixelSize(resourceId);
|
|
55
|
+
promise.resolve(result);
|
|
56
|
+
} else {
|
|
57
|
+
promise.resolve(0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
20
60
|
|
|
21
|
-
public RNEasyuiModule(ReactApplicationContext reactContext) {
|
|
22
|
-
super(reactContext);
|
|
23
|
-
this.context = reactContext;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Override
|
|
27
|
-
public String getName() {
|
|
28
|
-
return "RNEasyui";
|
|
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
61
|
|
|
45
62
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.easyui.utils;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
|
|
5
|
+
public class ScreenUtil {
|
|
6
|
+
|
|
7
|
+
public static int dp2px(Context context, float dp) {
|
|
8
|
+
final float scale = context.getResources().getDisplayMetrics().density;
|
|
9
|
+
return (int) (dp * scale + 0.5f);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public static int px2dp(Context context, float pxValue) {
|
|
13
|
+
final float scale = context.getResources().getDisplayMetrics().density;
|
|
14
|
+
return (int) (pxValue / scale + 0.5f);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
package/jsbridge/RNEasyui.ts
CHANGED
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-19 10:23:01
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-31 17:
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.
|
|
5
|
+
* @LastEditTime: 2022-05-31 17:26:16
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { NativeModules, Platform
|
|
9
|
+
import { Dimensions, NativeModules, Platform } from 'react-native';
|
|
10
10
|
|
|
11
11
|
const { RNEasyui } = NativeModules;
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const getStatusBarHeight = () => {
|
|
16
|
+
export const getStatusBarHeight = () => {
|
|
20
17
|
if (Platform.OS == 'android') return RNEasyui.getStatusBarHeight();
|
|
21
18
|
|
|
22
19
|
const deviceHeight = Dimensions.get('window').height;
|
|
@@ -24,7 +21,7 @@ const getStatusBarHeight = () => {
|
|
|
24
21
|
if (isiPhoneX) return Promise.resolve(44)
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
const getNavigationBarHeight = () => {
|
|
24
|
+
export const getNavigationBarHeight = () => {
|
|
28
25
|
if (Platform.OS == 'android') return RNEasyui.getNavigationBarHeight();
|
|
29
26
|
const deviceHeight = Dimensions.get('window').height;
|
|
30
27
|
const isiPhoneX = Platform.OS == 'ios' && (deviceHeight > 736)
|
package/jsbridge/index.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-19 10:23:01
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-31
|
|
5
|
+
* @LastEditTime: 2022-05-31 18:19:53
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/jsbridge/index.ts
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,33 +12,34 @@
|
|
|
12
12
|
* @param {*}
|
|
13
13
|
* @return {*}
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
export declare const getAppVersion: () => Promise<string>;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export declare type UpgradeOptions = {
|
|
19
|
+
title?: string;
|
|
20
|
+
version: string;
|
|
21
|
+
downloadUrl: string;
|
|
22
|
+
note: string;
|
|
23
|
+
force: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description: app升级
|
|
28
|
+
* @return {*}
|
|
29
|
+
*/
|
|
30
|
+
export declare const upgrade: (options: UpgradeOptions) => Promise<string>;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated 测量不准确,已放弃
|
|
36
|
+
* @description: 获取status_bar_height
|
|
37
|
+
* @return {*}
|
|
38
|
+
*/
|
|
39
|
+
export declare const getStatusBarHeight: () => Promise<number>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @description: 获取navigation_bar_height
|
|
43
|
+
* @return {*}
|
|
44
|
+
*/
|
|
45
|
+
export declare const getNavigationBarHeight: () => Promise<number>;
|
package/package.json
CHANGED
package/screen/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-19 10:25:14
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-31
|
|
5
|
+
* @LastEditTime: 2022-05-31 18:34:57
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/screen/index.ts
|
|
7
7
|
*/
|
|
8
8
|
export declare const deviceWidth: number; //设备的宽度
|
|
@@ -13,15 +13,13 @@ 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()获取
|
|
17
16
|
* @description: 状态栏的高度
|
|
18
17
|
* @param {*}
|
|
19
18
|
* @return {*}
|
|
20
19
|
*/
|
|
21
20
|
export declare const statusBarHeight: number;
|
|
22
21
|
/**
|
|
23
|
-
* @
|
|
24
|
-
* @description: 顶部导航条的高度
|
|
22
|
+
* @description: 顶部导航条的高度,高度不包含statusBarHeight
|
|
25
23
|
* @param {*}
|
|
26
24
|
* @return {*}
|
|
27
25
|
*/
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-15 14:15:07
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks/
|
|
5
|
+
* @LastEditTime: 2022-05-31 18:22:50
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/screen/init-fit.tsx
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* 全局配置Text
|
|
@@ -55,4 +55,8 @@ 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 './px2dp'
|
|
@@ -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-
|
|
6
|
-
* @FilePath: /@aks/easyui/screen/px2dp.
|
|
5
|
+
* @LastEditTime: 2022-05-31 18:34:36
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/screen/px2dp.ts
|
|
7
7
|
*/
|
|
8
|
-
import { Dimensions,
|
|
8
|
+
import { Dimensions, Platform, StatusBar } 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,8 +33,6 @@ export const px2dp = (uiElePx: number) => {
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
export const isiPhoneX = isIos && (deviceHeight > 736)
|
|
36
|
-
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
export const statusBarHeight = (() => {
|
|
@@ -44,8 +43,19 @@ export const statusBarHeight = (() => {
|
|
|
44
43
|
return 20
|
|
45
44
|
})()
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export let navigationBarHeight = (() => {
|
|
49
|
+
if (isAndroid) return statusBarHeight
|
|
50
|
+
if (isiPhoneX) return 44
|
|
51
|
+
return 24
|
|
52
|
+
})()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
import * as RNEasyui from '../jsbridge/RNEasyui';
|
|
57
|
+
; (async () => {
|
|
58
|
+
navigationBarHeight = await RNEasyui.getNavigationBarHeight();
|
|
51
59
|
})()
|
|
60
|
+
|
|
61
|
+
|
|
File without changes
|
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-
|
|
7
|
-
* @FilePath: /@aks/easyui/src/index.ts
|
|
6
|
+
* @LastEditTime: 2022-05-31 18:22:44
|
|
7
|
+
* @FilePath: /@aks-dev/easyui/src/index.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
|
|
@@ -54,7 +54,6 @@ export type { EchartsViewProps } from '../lib/Echarts'
|
|
|
54
54
|
export * from '../screen/px2dp'
|
|
55
55
|
export * from '../screen/px2sp'
|
|
56
56
|
|
|
57
|
-
|
|
58
57
|
/// 工具
|
|
59
58
|
import * as mode from '../utils/mode'
|
|
60
59
|
import * as lazy from '../utils/lazy'
|
|
File without changes
|
|
File without changes
|