mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix memory leak in action-bar for android. (#2854)
This commit is contained in:
@@ -194,7 +194,7 @@ export class ActionBar extends common.ActionBar {
|
||||
}
|
||||
|
||||
public _updateNavigationButton() {
|
||||
var navButton = this.navigationButton;
|
||||
let navButton = this.navigationButton;
|
||||
if (navButton && common.isVisible(navButton)) {
|
||||
if (navButton.android.systemIcon) {
|
||||
// Try to look in the system resources.
|
||||
@@ -208,10 +208,12 @@ export class ActionBar extends common.ActionBar {
|
||||
this._toolbar.setNavigationIcon(drawableOrId);
|
||||
}
|
||||
|
||||
let navBtn = new WeakRef(navButton);
|
||||
this._toolbar.setNavigationOnClickListener(new android.view.View.OnClickListener({
|
||||
onClick: function (v) {
|
||||
if (navButton) {
|
||||
navButton._raiseTap();
|
||||
let owner = navBtn.get();
|
||||
if (owner) {
|
||||
owner._raiseTap();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user