Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V4] ion-searchbar cancelSearchbar event error. #16143

Closed
mateoqac opened this issue Oct 30, 2018 · 1 comment · Fixed by #16181
Closed

[V4] ion-searchbar cancelSearchbar event error. #16143

mateoqac opened this issue Oct 30, 2018 · 1 comment · Fixed by #16181
Labels

Comments

@mateoqac
Copy link

Bug Report

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)             : 4.2.1
   Ionic Framework               : @ionic/angular 4.0.0-beta.12
   @angular-devkit/build-angular : 0.9.0-beta.3
   @angular-devkit/schematics    : 0.9.0-beta.3
   @angular/cli                  : 6.1.5
   @ionic/angular-toolkit        : 1.0.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   NodeJS : v8.12.0 (/Users/mateqac/.nvm/versions/node/v8.12.0/bin/node)
   npm    : 6.4.1
   OS     : macOS
   Xcode  : Xcode 10.0 Build version 10A255

Describe the Bug
cancelSearchbar event produce an error trying to do a blur to the nativeInput which is null

Steps to Reproduce
I have an ion-searchbar which I just show or hide depends on a variable value.

        <ion-searchbar #searhcBar *ngIf="toggled" animated mode="ios" [showCancelButton]="true" (ionCancel)="onCancel($event)"
            (ionInput)="triggerInput($event)"
            placeholder="{{'Search_athlete_list' | translate}}"></ion-searchbar>

The onCancel function just change de value of the variable:

  onCancel(event) {
    this.toggled = !this.toggled;
  }

When I click on the cancel button at the ion-searchbar I got the following error:

4v89pg1l.entry.js:65 Uncaught TypeError: Cannot read property 'blur' of null
    at Searchbar.push../node_modules/@ionic/core/dist/esm/es5/build/4v89pg1l.entry.js.Searchbar.cancelSearchbar (4v89pg1l.entry.js:65)
    at Searchbar.push../node_modules/@ionic/core/dist/esm/es5/build/4v89pg1l.entry.js.Searchbar.cancelSearchbar (4v89pg1l.entry.js:65)

The line on the code shows this:

this.nativeInput.blur();

Expected Behavior
Should close the search bar normally.

@ionitron-bot
Copy link

ionitron-bot bot commented Dec 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Dec 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant