Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't render empty TextCells for TableSections without Title (bugs 26104 and 42926) #287
Description of Change
When a TableSection has no header, then iOS doesn't render a header cell. Android rendered an empty TextCell and a separator line in the accent color. This could not be removed by the user.
With this change, the empty TextCell and the separator are not rendered. If you still want them, then you can set the Title to " ".
When I debugged the GetCellForPosition method, I saw that it was called very often. Before a TableView was rendered, the method was called twice for each Cell from GetView and twice for each Cell from IsEnabled. I removed one call from GetView, but IsEnabled is called twice from the adapter. I think the result of GetCellForPosition should be cached in a Cell or WeakReference and two bool for isHeader and nextIsHeader. Then it would not have to iterate over all Cells every time the method is called.
Hi @MichaelRumpler, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.
I forked it just minutes before I made the PR because when I tried to do the PR from my old fork, it also listed an old commit which has already been merged. So I deleted my repository and created it new.
Sorry, I don't know how rebase works and it seems like I always do it wrong.
I found another page which explained rebase and did:
git remote add xamarin https://github.com/xamarin/Xamarin.Forms.git
It doesn't seem like this PR changed, but I don't know what else I can do.
PS: What I forgot in the description, but it's obvious anyway: I did not write any tests because my change is only in Platform.Android and there are no tests for that project. I would've preferred to write tests for that too.
After consulting with Rui I also committed the caching of the Cells like I explained in the description.
(I hope I got rebase right at last)