Xamarin.forms: Top Padding not working on iOS when it is set alone.

Created on 13 Feb 2019  路  10Comments  路  Source: xamarin/Xamarin.Forms

Description

Xamarin.Forms content page top padding is not working if it is set alone. That is if the other padding values are zero the top padding will not work. Setting one of the other values to a non zero value together with the top padding, the top padding will work.

Steps to Reproduce

  1. Create new Xamarin.Forms application
  2. Delete the main page and add a new code only main page of type content page.
  3. Create a label
    Label label = new Label { Text = "Hello Xamarin World!" };
  4. Set the page padding
    Padding = new Thickness(0, 20, 0, 0);
  5. set the label as the content property of the page
    Content = label;

Expected Behavior

The label should have been displayed 20 units below the iOS status bar

Actual Behavior

The label is overlapping with the iOS status bar

Basic Information

  • Version with issue: 3.5.0.129452
  • Last known good version: I don't remeber (but I guess it was working fine on the earlier version of 3.2.0.871581
  • IDE: Visual Studio 2017
  • Platform Target Frameworks:

    • iOS:

  • Nuget Packages: NetStandardLibrary 2.0.3
  • Affected Devices:

Screenshots

image

Reproduction Link

2 regression iOS 馃崕 bug

Most helpful comment

I think this should be reopened as the stuff posted above is only a workaround, the actual bug still exists in XF 3.6.0.344457 for top padding = 20.

All 10 comments

I'm encountering this issue as well

Can you try setting only a top padding value, but setting it to a value of 19 or 21?
I have encountered this issue, but it happens only if the value is exactly 20. Other values work fine.

I have found a solution to this. Instead of setting the padding in the constructor of the page, set the property in the OnAppearing method by overriding it. That will do the trick.

I think this should be reopened as the stuff posted above is only a workaround, the actual bug still exists in XF 3.6.0.344457 for top padding = 20.

this is still an issue in 4.4.0.991757 and 4.5.0.356

Xamarin, workarounds do not mean you don't have to fix stuff. I swear, some of the bugs that get closed in here...

Hi! We closed this issue because we believed it was resolved in #6457. We don't typically see comments on closed issues unless we are specifically pinged. If you're still experiencing this problem, please file a new issue. Thanks!

Sounds like it probably wasn't fixed (I believe I'm having a related issue) but regardless if you could link fixes to the issues that would be helpful. Thanks!

edit: referring to the first time it was closed

We didn't close it the first time. That was the issue author. :)

Sure enough. Sorry, my mistake.

Was this page helpful?
0 / 5 - 0 ratings