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

Add redrawing of Snackbar and Toast when the screen is rotated #1405

Merged
merged 2 commits into from Sep 13, 2023

Conversation

cat0363
Copy link
Contributor

@cat0363 cat0363 commented Sep 13, 2023

This PR resolves the issue where when a long message that does not include a line feed code is specified for Snackbar and Toast, it is not drawn correctly after the screen is rotated.

Description of Change

Override the LayoutSubviews method of the RoundedView class that draws the Snackbar and Toast background and call the Draw method so that the Snackbar and Toast are redrawn after the screen is rotated.

[src\CommunityToolkit.Maui.Core\Views\RoundedView.macios.cs]

/// <inheritdoc />
public override void LayoutSubviews()
{
    base.LayoutSubviews();
    Draw(Frame);
}

This will cause Snackbar and Toast to be redrawn after the screen is rotated, so they will be drawn at the intended size.
This also resolves the issue where the corner shapes of Snackbar and Toast appear to have changed without being redrawn.

Linked Issues

PR Checklist

Additional information

Below are the verification results after fix.

[Snackbar]

[Before Rotation] [After Rotation]

[Toast]

[Before Rotation] [After Rotation]

In both execution results, you can see that the Snackbar and Toast are drawn at the intended size after the screen is rotated.

@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) September 13, 2023 19:12
@VladislavAntonyuk VladislavAntonyuk merged commit 51d39d2 into CommunityToolkit:main Sep 13, 2023
7 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.

[BUG] Snackbar and Toast corner shape changes when screen is rotated on iOS
2 participants