Creating a Custom Dialog View


#1

Hi i am new to native script development shifted from Android to this.

I have a search bar in my home page when i click on it custom dialog should open to select the cities when i selects the city(Intent in android) Should pass to next page

Right now when i click on the search bar. My keyboard is appearing. So I need to hide the keyboard and make the Custom Dialog to appear

Regards
Nagendra Bhat


#2

Hey @nagendrambhat,

You can set your searchbar as non editable.

<TextField [(ngModel)]="category" (tap)="selectCities()" editable="false"></TextField>

Then onTap event you may call method which will give you custom dialog.

selectCities(){
    dialogs.action({
    // message: "Your message",
    cancelButtonText: "Clear",
    actions: ["New York", "California"]
}).then(result => {
    console.log("Dialog result: " + result);
    if(result == "New York"){
    this.router.navigate(["/Newyork"]);
    }else if(result == "California"){
       this.router.navigate(["/California"]);
    }

});
}