mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
Fix: Multiple actionView items do not handle tap event correctly
Resolves #1878
This commit is contained in:
@ -267,15 +267,8 @@ export class ActionBar extends common.ActionBar {
|
||||
if (item.actionView && item.actionView.android) {
|
||||
// With custom action view, the menuitem cannot be displayed in a popup menu.
|
||||
item.android.position = enums.AndroidActionItemPosition.actionBar;
|
||||
|
||||
menuItem.setActionView(item.actionView.android);
|
||||
// Note: When using a custom action view the toolbar's MenuItemClickListener is not triggered!
|
||||
menuItem.getActionView().setOnClickListener(new android.view.View.OnClickListener({
|
||||
onClick:
|
||||
function () {
|
||||
item._raiseTap();
|
||||
}
|
||||
}));
|
||||
ActionBar._setOnClickListener(item);
|
||||
}
|
||||
else if (item.android.systemIcon) {
|
||||
// Try to look in the system resources.
|
||||
@ -299,6 +292,14 @@ export class ActionBar extends common.ActionBar {
|
||||
}
|
||||
}
|
||||
|
||||
private static _setOnClickListener(item: ActionItem): void {
|
||||
item.actionView.android.setOnClickListener(new android.view.View.OnClickListener({
|
||||
onClick: function (v: android.view.View) {
|
||||
item._raiseTap();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public _onTitlePropertyChanged() {
|
||||
var topFrame = frame.topmost();
|
||||
if (this._toolbar && topFrame && topFrame.currentPage === this.page) {
|
||||
|
Reference in New Issue
Block a user