js: add navbar set center api

This commit is contained in:
王劲鹏
2020-04-30 14:53:09 +08:00
committed by osborn
parent cc5a7ab011
commit d8649ac539
10 changed files with 80 additions and 21 deletions

View File

@@ -8,4 +8,5 @@ export declare function navbar(context: BridgeContext): {
setBgColor: (color: Color) => Promise<any>;
setLeft: (view: View) => Promise<any>;
setRight: (view: View) => Promise<any>;
setCenter: (view: View) => Promise<any>;
};

View File

@@ -31,6 +31,13 @@ export function navbar(context) {
panel.addHeadView("navbar_right", view);
}
return context.callNative('navbar', 'setRight', view.toModel());
}
},
setCenter: (view) => {
if (panel) {
panel.clearHeadViews("navbar_center");
panel.addHeadView("navbar_center", view);
}
return context.callNative('navbar', 'setCenter', view.toModel());
},
};
}

View File

@@ -48,7 +48,8 @@ export class List extends Superview {
}
}
scrollToItem(context, index, config) {
const animated = config === null || config === void 0 ? void 0 : config.animated;
var _a;
const animated = (_a = config) === null || _a === void 0 ? void 0 : _a.animated;
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
}
reset() {