Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

iOS Frame IsClippedToBounds broken [Bug] #11091

Closed
taublast opened this issue Jun 17, 2020 · 5 comments
Closed

iOS Frame IsClippedToBounds broken [Bug] #11091

taublast opened this issue Jun 17, 2020 · 5 comments
Assignees
Labels
4.6.0 regression on 4.6.0 a/frame i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often i/regression in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛

Comments

@taublast
Copy link

taublast commented Jun 17, 2020

Description

After upgrading from Forms from 4.6.0.726 to 4.6.0.967
frames on iOS stopped clipping content, tested with a grid inside.

Edit: Last good version checked 4.6.0.847 is okay.

Steps to Reproduce

<frame    CornerRadius="something"     IsClippedToBounds="True">
    <grid>
    <image/><or whatever/>
    </grid>
<frame>

Please kindly check here:
https://forums.xamarin.com/discussion/comment/414472

Expected Behavior

frame to clip content while IsClippedToBounds="True"

Actual Behavior

Not clipping content while IsClippedToBounds="True"

Basic Information

  • Version with issue: Forms 4.6.0.967
  • Last known good version: 4.6.0.847
  • IDE: VS 2019 16.6.2
  • Platform Target Frameworks:
    • iOS: latest.. no idea where to check the version when developing from windows

Screenshots

image

Reproduction Link

https://forums.xamarin.com/discussion/comment/414472 confirmed by xamarin staff, LeonLu.

Workaround

credits to LeonLu

[assembly: ExportRenderer(typeof(Frame), typeof(FrameFix))]
   namespace Your.iOS.Renderers
   {
       protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
       {
           base.OnElementChanged(e);

           if (e.OldElement != null && Control != null)
           {
               Control.PropertyChanged -= OnControlPropertyChanged;
           }

           if (e.NewElement!=null && NativeView != null)
           {
               Control = e.NewElement;
               Control.PropertyChanged += OnControlPropertyChanged;
               
               UpdateCorners();
           }
       }

       protected void UpdateCorners()
       {
           NativeView.Layer.AllowsEdgeAntialiasing = true;
           NativeView.Layer.MasksToBounds = Control.IsClippedToBounds;
           NativeView.Layer.CornerRadius = Control.CornerRadius;
       }

       private void OnControlPropertyChanged(object sender, PropertyChangedEventArgs e)
       {
           if (NativeView == null || Control == null)
               return;

           if (e.PropertyName == "IsClippedToBounds" 
               || e.PropertyName == "CornerRadius")
           {
               UpdateCorners();
           }
       }
   }
@taublast taublast added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 17, 2020
@pauldipietro pauldipietro added this to New in Triage Jun 17, 2020
@jsuarezruiz jsuarezruiz added a/frame i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 labels Jun 18, 2020
@Codelisk
Copy link

Already solved in nightly build version Xamarin.Forms nighly build 4.8.0.908

@StephaneDelcroix StephaneDelcroix moved this from New to Ready For Work in Triage Jun 19, 2020
@StephaneDelcroix StephaneDelcroix removed the s/unverified New report that has yet to be verified label Jun 19, 2020
@samhouts samhouts moved this from Ready For Work to Needs Estimate in Triage Jun 19, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Jun 20, 2020
@samhouts samhouts added this to In Progress in 4.7.0 Jun 20, 2020
@MSiccDev
Copy link

Just adding that UWP also works, it is really only iOS.

@thisisthekap
Copy link
Contributor

Is this one going to be fixed on 4.6.0?

@knasher
Copy link
Contributor

knasher commented Jul 3, 2020

I've just upgraded to 4.7.1080 and this behaviour is still happening; the release notes mentioned there was a fix for #11031

@samhouts samhouts moved this from In Progress to Done in 4.7.0 Jul 6, 2020
@samhouts samhouts moved this from In progress to Done in Sprint 173 Jul 6, 2020
@samhouts
Copy link
Member

closed by #11129

Triage automation moved this from Needs Estimate to Closed Jul 13, 2020
@samhouts samhouts removed this from Closed in Triage Aug 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.6.0 regression on 4.6.0 a/frame i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often i/regression in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Projects
No open projects
4.7.0
  
Done
Sprint 173
  
Done
Development

No branches or pull requests

7 participants