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

[Android-Ng] Catching back button event on modal · Issue #3908 · NativeScript/NativeScript · GitHub

[Android-Ng] Catching back button event on modal #3908

Description

Dear friend, we, the rest of the NativeScript community really
appreciate your feedback! While we are doing all we can to take care of every
issue, sometimes we get overwhelmed. Because of that, we will consider issues
that are not constructive or problems that cannot be reproduced "dead".
Additionally, we will treat feature requests or bug reports with unanswered
questions regarding the behavior/reproduction for more than 20 days "dead". All
"dead" issues will get closed.

Please, provide the details below:

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: v2.5.2
  • Cross-platform modules: 2.5.1
  • Runtime(s): 2.5.0
  • Plugin(s):
    "@angular/common": "2.4.3",
    "@angular/compiler": "2.4.3",
    "@angular/core": "2.4.3",
    "@angular/forms": "2.4.3",
    "@angular/http": "2.4.3",
    "@angular/platform-browser": "2.4.3",
    "@angular/platform-browser-dynamic": "2.4.3",
    "@angular/router": "3.4.3",
    "nativescript-angular": "1.4.0",
    "nativescript-localize": "^1.9.3",
    "nativescript-slides": "^2.2.8",
    "nativescript-statusbar": "0.0.3",
    "nativescript-telerik-ui": "^1.6.1",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.0.1",
    "tns-core-modules": "2.5.1"

Please tell us how to recreate the issue in as much detail as possible.

i'm trying to prevent(disable) back button that can accidentally be pressed while modal page showing up.

modal page opened like this

ModalDialogService.showModal( component )

and i tried to catch event using code below
application.android.on(application.AndroidApplication.activityBackPressedEvent, backCallback);
this code on parent and modal component but it doesn't work on while app currently shows up modal page.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Parent Component

ngOnInit() 
 { 
 	if (application.android) {
            application.android.on(application.AndroidApplication.activityBackPressedEvent, this.onBack);
        }
}
onBack(args:application.AndroidActivityBackPressedEventData)
{                  
		console.dump(args);
}
onSignUp()
{
	var options: ModalDialogOptions = {
		viewContainerRef: this.viewRef,
		fullscreen: true
   };
	this.modal.showModal(ModalComponent,options);
}

Modal.component.html

<StackLayout>
    <SlideContainer #slides>
        <Slide>
         ... some contents
        </Slide>
    </SlideContainer>
</StackLayout>

ModalComponent.ts

export class ModalComponent implements OnInit {

	@ViewChild("slides") slides: ElementRef;

	constructor(private params : ModalDialogParams ){
} .... 

}
```


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL