add navbar custom left & right view api
This commit is contained in:
3
doric-js/lib/src/native/navbar.d.ts
vendored
3
doric-js/lib/src/native/navbar.d.ts
vendored
@@ -1,8 +1,11 @@
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
import { Color } from "../util/color";
|
||||
import { View } from "../ui/view";
|
||||
export declare function navbar(context: BridgeContext): {
|
||||
isHidden: () => Promise<boolean>;
|
||||
setHidden: (hidden: boolean) => Promise<any>;
|
||||
setTitle: (title: string) => Promise<any>;
|
||||
setBgColor: (color: Color) => Promise<any>;
|
||||
setLeft: (view: View) => Promise<any>;
|
||||
setRight: (view: View) => Promise<any>;
|
||||
};
|
||||
|
@@ -24,5 +24,19 @@ export function navbar(context) {
|
||||
color: color.toModel(),
|
||||
});
|
||||
},
|
||||
setLeft: (view) => {
|
||||
if (panel) {
|
||||
panel.clearHeadViews("navbar_left");
|
||||
panel.addHeadView("navbar_left", view);
|
||||
}
|
||||
return context.navbar.setLeft(view.toModel());
|
||||
},
|
||||
setRight: (view) => {
|
||||
if (panel) {
|
||||
panel.clearHeadViews("navbar_right");
|
||||
panel.addHeadView("navbar_right", view);
|
||||
}
|
||||
return context.navbar.setRight(view.toModel());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -123,7 +123,12 @@ export class Panel {
|
||||
if (cur === this.__root__.viewId) {
|
||||
return this.__root__;
|
||||
}
|
||||
return this.headviews.get(cur);
|
||||
for (let map of this.headviews.values()) {
|
||||
if (map.has(cur)) {
|
||||
return map.get(cur);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
if (Reflect.has(acc, "subviewById")) {
|
||||
|
Reference in New Issue
Block a user