Skip to content

Commit

Permalink
fix(searchbar): do not animate during initial load (#16147)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 30, 2018
1 parent fc64f7e commit e94b522
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core/src/components/searchbar/searchbar.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@
pointer-events: none;
}

:host(.searchbar-no-animate) .searchbar-search-icon,
:host(.searchbar-no-animate) .searchbar-input,
:host(.searchbar-no-animate) .searchbar-cancel-button {
transition-duration: 0ms;
}

// Searchbar Color
// -----------------------------------------
Expand Down
10 changes: 9 additions & 1 deletion core/src/components/searchbar/searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class Searchbar implements ComponentInterface {
@Prop({ context: 'document' }) doc!: Document;

@State() focused = false;
@State() noAnimate = true;

/**
* The color to use from your application's color palette.
Expand Down Expand Up @@ -151,6 +152,10 @@ export class Searchbar implements ComponentInterface {
componentDidLoad() {
this.positionElements();
this.debounceChanged();

setTimeout(() => {
this.noAnimate = false;
}, 300);
}

/**
Expand Down Expand Up @@ -328,10 +333,13 @@ export class Searchbar implements ComponentInterface {
}

hostData() {
const animated = this.animated && this.config.getBoolean('animated', true);

return {
class: {
...createColorClasses(this.color),
'searchbar-animated': this.animated && this.config.getBoolean('animated', true),
'searchbar-animated': animated,
'searchbar-no-animate': animated && this.noAnimate,
'searchbar-has-value': (this.getValue() !== ''),
'searchbar-show-cancel': this.showCancelButton,
'searchbar-left-aligned': this.shouldAlignLeft,
Expand Down

0 comments on commit e94b522

Please sign in to comment.