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

[iOS] Fix issue with ListView wrong top padding in iOS 15 #14671

Merged
merged 2 commits into from
Oct 7, 2021
Merged

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Sep 29, 2021

Description of Change

Fix issue with ListView wrong top padding in iOS 15.

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

Before
Captura de pantalla 2021-09-29 a las 10 21 08

After
Captura de pantalla 2021-09-29 a las 10 34 06

Before/After Screenshots

Not applicable

Testing Procedure

Launch Core Gallery and navigate to the issue 14664. If the ListView does not have a top padding, the test has passed.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@@ -271,6 +271,9 @@ protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
_tableViewController = new FormsUITableViewController(e.NewElement, _usingLargeTitles);
SetNativeControl(_tableViewController.TableView);

if (Forms.IsiOS15OrNewer)
_tableViewController.TableView.SectionHeaderTopPadding = new nfloat(0);
Copy link
Member

Choose a reason for hiding this comment

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

Although this fixes it, are we sure this is the actual issue? Is this a bug in iOS? Is our code causing this somehow only for iOS 15?

Copy link
Contributor Author

@jsuarezruiz jsuarezruiz Sep 29, 2021

Choose a reason for hiding this comment

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

We definitely need to analyze this well, we need more time. The PR is a Draft until we review everything better and we are really sure about everything. Also, need to sync with the iOS team.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"error CS1061: 'UITableView' does not contain a definition for 'SectionHeaderTopPadding' and no accessible extension method 'SectionHeaderTopPadding' accepting a first argument of type 'UITableView' could be found (are you missing a using directive or an assembly reference?) [D:\agent\2\s\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj]"

cc @rmarinho

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a good forum topic here on this issue. Looks like a design feature of iOS 15.
We've had to override this with a custom renderer when building with latest Xamarin.OS and Xcode. I wonder if this possibly is a good candidate for a platform-specific?

https://developer.apple.com/forums/thread/683980

Copy link
Contributor

@velocitysystems velocitysystems Oct 1, 2021

Choose a reason for hiding this comment

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

@jsuarezruiz Looks like the hosted build agents on Azure DevOps aren't yet configured with the latest Xamarin.iOS and/or Xcode versions. I can confirm the same result in a hosted pipeline.

@jfversluis jfversluis added this to Issues in Progress in 5.0.0 SR6 (Planning) - Target Date Oct. 13th via automation Oct 2, 2021
@jfversluis jfversluis moved this from Issues in Progress to PR Build/Test Failures in 5.0.0 SR6 (Planning) - Target Date Oct. 13th Oct 2, 2021
@jsuarezruiz
Copy link
Contributor Author

jsuarezruiz commented Oct 6, 2021

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@jsuarezruiz jsuarezruiz marked this pull request as ready for review October 6, 2021 14:33
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis jfversluis moved this from PR Build/Test Failures to PR Needs Review in 5.0.0 SR6 (Planning) - Target Date Oct. 13th Oct 7, 2021
@jfversluis jfversluis merged commit 9fb6583 into 5.0.0 Oct 7, 2021
5.0.0 SR6 (Planning) - Target Date Oct. 13th automation moved this from PR Needs Review to Done Oct 7, 2021
@jfversluis jfversluis deleted the fix-14664 branch October 7, 2021 18:25
@amiramin476
Copy link

@jfversluis When do we expect the 5.0.0 SR6 official release? We are waiting for this fix for our Xamarin app on iOS

@jfversluis
Copy link
Member

@amiramin476 Later today! :) Check the project boards for things we are working on and target dates. Few days late because of quality checks, but all looks good now!

@MitchBomcanhao
Copy link

MitchBomcanhao commented Oct 19, 2021

so, due to this SR6 change we have to use the latest xcode/visual studio in order for the ios build to run? We started getting build failures like this:
MTOUCH : error MT2101: Can't resolve the reference 'System.Void UIKit.UITableView::set_SectionHeaderTopPadding(System.nfloat)', referenced from the method 'System.Void Xamarin.Forms.Platform.iOS.ListViewRenderer
only resolved if we run the build on a newer build agent.

@jfversluis
Copy link
Member

For now, yes. We're working on fixing that, see #14752

@pboisso
Copy link

pboisso commented Nov 23, 2021

Same problem appeared here recently. VStudio for Mac says I'm up to date as of today.

The padding issue is still there with XF 4.8 with the latest VStudio and Xamarin.iOS. Any fixes in Xamarin.iOS rather than XF 5.x?

@jfversluis
Copy link
Member

Same problem appeared here recently. VStudio for Mac says I'm up to date as of today.

The padding issue is still there with XF 4.8 with the latest VStudio and Xamarin.iOS. Any fixes in Xamarin.iOS rather than XF 5.x?

As mentioned in the other issue, no. This will only be fixed in Forms 5.

rotorgames pushed a commit to rotorgames/Xamarin.Forms that referenced this pull request Jun 22, 2022
# Conflicts:
#	Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/listview Problems with the ListView/TableView iOS 15 t/bug 🐛
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

[Bug] In Xamarion.forms ListView has some issue with iOS 15 ListView has a unexpected top padding on iOS 15
6 participants