feat:add statusBarHeight in Environment
This commit is contained in:
parent
2e172a1cfd
commit
4363ef17eb
@ -101,7 +101,8 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
|
||||
.put("appName", appName)
|
||||
.put("appVersion", appVersion)
|
||||
.put("screenWidth", DoricUtils.px2dp(DoricUtils.getScreenWidth()))
|
||||
.put("screenHeight", DoricUtils.px2dp(DoricUtils.getScreenHeight()));
|
||||
.put("screenHeight", DoricUtils.px2dp(DoricUtils.getScreenHeight()))
|
||||
.put("statusBarHeight", DoricUtils.px2dp(DoricUtils.getStatusBarHeight(Doric.application())));
|
||||
|
||||
Map<String, Object> extend = mDoricRegistry.getEnvironmentVariables();
|
||||
for (String key : extend.keySet()) {
|
||||
|
@ -62,6 +62,7 @@ - (void)initJSExecutor {
|
||||
@"appVersion": infoDictionary[@"CFBundleShortVersionString"],
|
||||
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
|
||||
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
|
||||
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
|
||||
} mutableCopy];
|
||||
|
||||
[self.registry.environmentVariables enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) {
|
||||
|
1
doric-js/index.d.ts
vendored
1
doric-js/index.d.ts
vendored
@ -50,6 +50,7 @@ declare module 'doric/lib/src/runtime/global' {
|
||||
libVersion: string;
|
||||
screenWidth: number;
|
||||
screenHeight: number;
|
||||
statusBarHeight: number;
|
||||
[index: string]: number | string | boolean | object | undefined;
|
||||
};
|
||||
function Entry(constructor: {
|
||||
|
1
doric-js/lib/src/runtime/global.d.ts
vendored
1
doric-js/lib/src/runtime/global.d.ts
vendored
@ -36,6 +36,7 @@ declare global {
|
||||
libVersion: string;
|
||||
screenWidth: number;
|
||||
screenHeight: number;
|
||||
statusBarHeight: number;
|
||||
[index: string]: number | string | boolean | object | undefined;
|
||||
};
|
||||
function Entry(constructor: {
|
||||
|
@ -60,6 +60,8 @@ declare global {
|
||||
|
||||
screenHeight: number,
|
||||
|
||||
statusBarHeight: number,
|
||||
|
||||
[index: string]: number | string | boolean | object | undefined
|
||||
}
|
||||
function Entry(constructor: { new(...args: any[]): {} }): any
|
||||
|
Reference in New Issue
Block a user