add notch declaration

This commit is contained in:
王劲鹏 2020-03-19 14:32:42 +08:00 committed by osborn
parent 06562aa665
commit f9a86a7f88
13 changed files with 132 additions and 1 deletions

View File

@ -0,0 +1,34 @@
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, IVLayout, IText, notch, modal, Gravity } from "doric";
import { title, label, colors } from "./utils";
@Entry
class NotchDemo extends Panel {
build(rootView: Group): void {
scroller(vlayout([
title("Notch Demo"),
label('area').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just(),
onClick: () => {
notch(context).inset()
.then((inset) => {
modal(context).toast("top: " + inset.top + "\n" + "left: " + inset.left + "\n" + "bottom: " + inset.bottom + "\n" + "right: " + inset.right, Gravity.Bottom)
})
.catch(() => {
})
}
} as IText),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
layoutConfig: layoutConfig().most(),
}).in(rootView)
}
}

View File

@ -3026,6 +3026,14 @@ function coordinator(context) {
};
}
function notch(context) {
return {
inset: function () {
return context.callNative('notch', 'inset', {});
}
};
}
var __values$5 = (undefined && undefined.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) { return m.call(o); }
@ -3220,6 +3228,7 @@ exports.modal = modal;
exports.navbar = navbar;
exports.navigator = navigator;
exports.network = network;
exports.notch = notch;
exports.notification = notification;
exports.obj2Model = obj2Model;
exports.popover = popover;

View File

@ -2300,6 +2300,14 @@ function coordinator(context) {
};
}
function notch(context) {
return {
inset: () => {
return context.callNative('notch', 'inset', {});
}
};
}
class Observable {
constructor(provider, clz) {
this.observers = new Set;
@ -2448,6 +2456,7 @@ exports.modal = modal;
exports.navbar = navbar;
exports.navigator = navigator;
exports.network = network;
exports.notch = notch;
exports.notification = notification;
exports.obj2Model = obj2Model;
exports.popover = popover;

View File

@ -3759,6 +3759,14 @@ function coordinator(context) {
};
}
function notch(context) {
return {
inset: () => {
return context.callNative('notch', 'inset', {});
}
};
}
class Observable {
constructor(provider, clz) {
this.observers = new Set;
@ -4042,6 +4050,7 @@ exports.modal = modal;
exports.navbar = navbar;
exports.navigator = navigator;
exports.network = network;
exports.notch = notch;
exports.notification = notification;
exports.obj2Model = obj2Model;
exports.popover = popover;

13
doric-js/index.d.ts vendored
View File

@ -101,6 +101,7 @@ declare module 'doric/lib/src/native/index.native' {
export * from 'doric/lib/src/native/notification';
export * from 'doric/lib/src/native/statusbar';
export * from 'doric/lib/src/native/coordinator';
export * from 'doric/lib/src/native/notch';
}
declare module 'doric/lib/src/util/index.util' {
@ -1023,6 +1024,18 @@ declare module 'doric/lib/src/native/coordinator' {
};
}
declare module 'doric/lib/src/native/notch' {
import { BridgeContext } from "doric/lib/src/runtime/global";
export function notch(context: BridgeContext): {
inset: () => Promise<{
top: number;
left: number;
bottom: number;
right: number;
}>;
};
}
declare module 'doric/lib/src/util/color' {
import { Modeling } from "doric/lib/src/util/types";
/**

View File

@ -8,3 +8,4 @@ export * from './animate';
export * from './notification';
export * from './statusbar';
export * from './coordinator';
export * from './notch';

View File

@ -23,3 +23,4 @@ export * from './animate';
export * from './notification';
export * from './statusbar';
export * from './coordinator';
export * from './notch';

9
doric-js/lib/src/native/notch.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import { BridgeContext } from "../runtime/global";
export declare function notch(context: BridgeContext): {
inset: () => Promise<{
top: number;
left: number;
bottom: number;
right: number;
}>;
};

View File

@ -0,0 +1,7 @@
export function notch(context) {
return {
inset: () => {
return context.callNative('notch', 'inset', {});
}
};
}

View File

@ -23,3 +23,4 @@ export * from './animate'
export * from './notification'
export * from './statusbar'
export * from './coordinator'
export * from './notch'

View File

@ -0,0 +1,29 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BridgeContext } from "../runtime/global"
export function notch(context: BridgeContext) {
return {
inset: () => {
return context.callNative('notch', 'inset', {}) as Promise<{
top: number,
left: number,
bottom: number,
right: number,
}>
}
}
}

View File

@ -3817,6 +3817,14 @@ function coordinator(context) {
};
}
function notch(context) {
return {
inset: () => {
return context.callNative('notch', 'inset', {});
}
};
}
class Observable {
constructor(provider, clz) {
this.observers = new Set;
@ -3965,6 +3973,7 @@ exports.modal = modal;
exports.navbar = navbar;
exports.navigator = navigator;
exports.network = network;
exports.notch = notch;
exports.notification = notification;
exports.obj2Model = obj2Model;
exports.popover = popover;

File diff suppressed because one or more lines are too long