FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(view): expose method for android back override by MartoYankov · Pull Request #5537 · NativeScript/NativeScript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (5) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion tns-core-modules/ui/core/view/view-common.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
return false;
}

public _onBackPressed(): boolean {
public onBackPressed(): boolean {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion tns-core-modules/ui/core/view/view.android.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function initializeDialogFragment() {
};
view.notify(args);

if (!args.cancel && !view._onBackPressed()) {
if (!args.cancel && !view.onBackPressed()) {
super.onBackPressed();
}
}
Expand Down
5 changes: 3 additions & 2 deletions tns-core-modules/ui/core/view/view.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,11 @@ export abstract class View extends ViewBase {
* @private
*/
_onLivesync(): boolean;

/**
* @private
* Derived classes can override this method to handle Android back button press.
*/
_onBackPressed(): boolean;
onBackPressed(): boolean;
/**
* @private
*/
Expand Down
4 changes: 2 additions & 2 deletions tns-core-modules/ui/frame/frame.android.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class Frame extends FrameBase {
}
}

public _onBackPressed(): boolean {
public onBackPressed(): boolean {
if (this.canGoBack()) {
this.goBack();
return true;
Expand Down Expand Up @@ -884,7 +884,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
};
view.notify(viewArgs);

if (!viewArgs.cancel && !view._onBackPressed()) {
if (!viewArgs.cancel && !view.onBackPressed()) {
callSuper = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions tns-core-modules/ui/tab-view/tab-view.android.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,10 @@ export class TabView extends TabViewBase {
super.disposeNativeView();
}

public _onBackPressed(): boolean {
public onBackPressed(): boolean {
const currentView = this._selectedView;
if (currentView) {
return currentView._onBackPressed();
return currentView.onBackPressed();
}

return false;
Expand Down

Back | FazBrowse Home | New Git URL