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

Fix AnimatedImage aspectRatio issue when ratio is nil #301

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

arnauddorgans
Copy link
Contributor

As reported by hstdt on #279 removing _AspectRatioLayout modifier when aspectRatio is nil fixes the issue

@@ -631,6 +636,7 @@ extension AnimatedImage {
/// fill the parent context.
/// - Returns: A view that constrains this view's dimensions to
/// `aspectRatio`, using `contentMode` as its scaling algorithm.
@ViewBuilder
Copy link
Collaborator

@dreampiggy dreampiggy Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not need ? Seems I can not get what cause this.


Oh, I understand. You change this function to a ViewBuilder with if-else condition and return different View type for (some View), so this is needed

@dreampiggy
Copy link
Collaborator

dreampiggy commented Mar 9, 2024

I just merge and code garden your changes

Since you do not gain the edit access from your fork repo for this PR (https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork), you'd better click that Allow edits from maintainers.

Actually, only 3 lines changes is enough. No need for temp func.

@dreampiggy dreampiggy changed the title Fix AnimatedImage Ratio Fix AnimatedImage aspectRatio issue when ratio is nil Mar 9, 2024
@dreampiggy dreampiggy merged commit b7ce54d into SDWebImage:2.x Mar 9, 2024
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The behavior of aspectRatio between AnimatedImage and WebImage is not same
2 participants