Skip to content

Commit e94b522

Browse files
authored
fix(searchbar): do not animate during initial load (ionic-team#16147)
1 parent fc64f7e commit e94b522

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

core/src/components/searchbar/searchbar.ios.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@
143143
pointer-events: none;
144144
}
145145

146+
:host(.searchbar-no-animate) .searchbar-search-icon,
147+
:host(.searchbar-no-animate) .searchbar-input,
148+
:host(.searchbar-no-animate) .searchbar-cancel-button {
149+
transition-duration: 0ms;
150+
}
146151

147152
// Searchbar Color
148153
// -----------------------------------------

core/src/components/searchbar/searchbar.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class Searchbar implements ComponentInterface {
2424
@Prop({ context: 'document' }) doc!: Document;
2525

2626
@State() focused = false;
27+
@State() noAnimate = true;
2728

2829
/**
2930
* The color to use from your application's color palette.
@@ -151,6 +152,10 @@ export class Searchbar implements ComponentInterface {
151152
componentDidLoad() {
152153
this.positionElements();
153154
this.debounceChanged();
155+
156+
setTimeout(() => {
157+
this.noAnimate = false;
158+
}, 300);
154159
}
155160

156161
/**
@@ -328,10 +333,13 @@ export class Searchbar implements ComponentInterface {
328333
}
329334

330335
hostData() {
336+
const animated = this.animated && this.config.getBoolean('animated', true);
337+
331338
return {
332339
class: {
333340
...createColorClasses(this.color),
334-
'searchbar-animated': this.animated && this.config.getBoolean('animated', true),
341+
'searchbar-animated': animated,
342+
'searchbar-no-animate': animated && this.noAnimate,
335343
'searchbar-has-value': (this.getValue() !== ''),
336344
'searchbar-show-cancel': this.showCancelButton,
337345
'searchbar-left-aligned': this.shouldAlignLeft,

0 commit comments

Comments
 (0)