-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
Issue Description
On iOS, I have an ImageSource
that I want to pass to some Image
components:
<Image *ngIf="cond" [src]="myImageSource"></Image>
<Image *ngIf="otherCond" [src]="myImageSource"></Image>
But when Image
is disposed, it clears the content of the provided ImageSource
(this.imageSource.ios = null;
), which makes it not reusable!
NativeScript/packages/core/ui/image/index.ios.ts
Lines 29 to 41 in 0506012
public disposeImageSource() { | |
if (this.nativeViewProtected?.image === this.imageSource?.ios) { | |
this.nativeViewProtected.image = null; | |
} | |
if (this.imageSource?.ios) { | |
this.imageSource.ios = null; | |
} | |
this.imageSource = null; | |
queueGC(); | |
} |
Note that when src
is an ImageSource
, the _createImageSourceFromSrc
function does not create but just use the provided ImageSource
NativeScript/packages/core/ui/image/image-common.ts
Lines 124 to 127 in 0506012
} else if (value instanceof ImageSource) { | |
// Support binding the imageSource trough the src property | |
this.imageSource = value; | |
this.isLoading = false; |
Reproduction
No response
Relevant log output (if applicable)
No response
Environment
No response
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- This is a bug report
- I agree to follow this project's Code of Conduct