Skip to content
This repository was archived by the owner on Dec 19, 2021. It is now read-only.

Commit ac17a3b

Browse files
committed
fix(loading-indicator) Fix duplicate loading indicator on Android
Previously if you selected show twice, the loading indicator graphic would populate the popOver twice.
1 parent 34b394f commit ac17a3b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/loading-indicator.android.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ export class LoadingIndicator {
4949
if (context) {
5050
options = options || {};
5151
options.android = options.android || {};
52-
options.userInteractionEnabled =
53-
options.userInteractionEnabled !== undefined || true;
52+
options.userInteractionEnabled = options.userInteractionEnabled !== undefined;
5453

5554
if (!this._popOver) {
5655
this._isCreatingPopOver = true;
@@ -478,9 +477,15 @@ export class LoadingIndicator {
478477
options.mode !== Mode.CustomView &&
479478
options.mode === Mode.Indeterminate
480479
) {
481-
const progressView = new android.widget.ProgressBar(context);
482-
progressView.setId(this._progressId);
483-
parentView.addView(progressView, 0);
480+
/**
481+
* Get the existing indicator if it exists, assess whether or not the
482+
* acquired child is the correct class.
483+
*/
484+
let progressView = parentView.getChildAt(0);
485+
if (progressView instanceof android.widget.ProgressBar === false || progressView === undefined) {
486+
progressView = new android.widget.ProgressBar(context);
487+
}
488+
484489
if (options.color) {
485490
this._setColor(options.color, progressView);
486491
this._currentProgressColor = new Color(options.color);
Binary file not shown.

0 commit comments

Comments
 (0)