-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Border size changes appear to be animated on iOS/MacCatalyst #15363
Comments
Has anyone found a work around for this? I am also suffering grief from this animation. I have had to switch some of my Borders to Frames until this issue is resolved or a workaround is found. For reference, in an attempt to debug the problem I tried overriding most methods in BorderHandler and doing this: UIView.PerformWithoutAnimation(() =>
}); But this did NOT work. |
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
It's a default iOS behavior but it would be great to be able to control it. It's super unnatural in collection views when you scroll through items and everything just animates like crazy. |
Microsoft.Maui.Handlers.BorderHandler.Mapper.PrependToMapping("DON'T ANIMATE YOU FILTHY ANIMAL", (handler, view) =>
{
foreach (var layer in handler.PlatformView.Layer.Sublayers)
{
layer.RemoveAllAnimations();
}
handler.PlatformView.Layer.RemoveAllAnimations();
}); This sort of worked for me. It doesn't remove all the animations but in a collection view it stops doing background animations. |
It’s good to learn that this is coming from CALayer. Thanks for your research.
|
I've created a temporary workaround for the Border control by using a behavior that sets PlatformView's Layer properties. I updated the sample repository to show an example of usage. In this case, the behavior works on any layout control, but I'm using it by temporarily replacing Border with ContentView. Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-06-26.at.09.15.34.mp4It's a bit inelegant, but as I only use Border within my own BorderView control, it was a quick fix that can be removed when Border is repaired. My borders all use a round rectangle, but other shapes can be implemented. The second rectangle (light green) is a VSL with the BorderBehavior added. Note the green bar: that's to prove that the borders are actually the correct thickness. Apparently there's a bug on iOS that renders borders at half the thickness specified...I've only just noticed it, but it doesn't happen on Android so it's likely a bug. I'll have to report that a little later. |
Having researched the issue over the weekend, all stroke-related changes call the |
I had the same problem, that was fixed in this PR https://github.com/dotnet/maui/pull/15856/files, its easy to apply the fix while is not release to .NET 7 |
@matheusouz Would you care to share your workaround/fix? The PR fixes 3-4 issues and has changes to the iOS ContentView that I don't find so easy to apply. How did you go about, and what pieces did you take from the PR? (I'm mainly interested in stopping the size change animation) What I have tried is subclassing the
And register the handler for
I can see that my |
Description
When I use the Border control in a page, when first drawn (and in subsequent redraws/resizes) the border/contents appear to animate the changes. This results in weird visual artifacts that don't occur when using layout controls with background color set.
Steps to Reproduce
Create a .NET MAUI project with a button and a border within a vertical stack layout. Wire up the button click handler so it toggles the width of the border. Notice that the border size change seems to be animated as compared to the vertical stack layout without the border. This only happens on iOS and MacCatalyst.
Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-05-30.at.15.19.38.mp4
Link to public reproduction project repository
https://github.com/DancesWithDingo/MAUI_BorderFillChange.git
Version with bug
7.0.49
Last version that worked well
Unknown/Other
Affected platforms
iOS, macOS
Affected platform versions
iOS 16.4
Did you find any workaround?
No. And the visual impact can be horrendous when many borders appear on a page.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: