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

[iOS] Fix: CollectionView was not updating when it was invisible #14384

Merged
merged 4 commits into from
Aug 25, 2021

Conversation

rotorgames
Copy link
Contributor

Description of Change

If a CollectionView is not visible and an ObservableCollection notifies about changes the CollectionView doesn't react.
Also, after changing the CollectionView's visibility to visible and making any changes in the ObservableCollection we can get exceptions like this: #14045 (comment)

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

  • Create a page with CollectionView and bind ItemsSource to ObservableCollection
  • Set IsVisible to false for the CollectionView
  • Add some items into the ObservableCollection
  • Set IsVisible to true for CollectionView
  • You will se, that the CollectionView doesn't show new items

PR Checklist

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

@jsuarezruiz jsuarezruiz requested a review from hartez July 1, 2021 19:20
@rotorgames rotorgames changed the title [iOS] Fix: CollectionView was not updating when it was invisible [iOS] Fix: CollectionView was not updating when it was invisible ** DON'T MERGE** Jul 9, 2021
@rotorgames
Copy link
Contributor Author

rotorgames commented Jul 9, 2021

@hartez Don't merge, I would like to put more changes.
ETA: 1-2 days.

@rmarinho rmarinho added the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Jul 9, 2021
…r of items in section X when there are only X sections in the collection view when NumberOfItemsInSection is invoked
@rotorgames
Copy link
Contributor Author

@hartez done. Review this please.

@rotorgames rotorgames changed the title [iOS] Fix: CollectionView was not updating when it was invisible ** DON'T MERGE** [iOS] Fix: CollectionView was not updating when it was invisible Jul 11, 2021
@rmarinho rmarinho removed the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Jul 12, 2021
@rmarinho rmarinho requested a review from hartez July 12, 2021 09:05
…or number of items in section X when there are only X sections in the collection view when NumberOfItemsInSection is invoked"

This reverts commit 2343f15.
…is hidded to avoid "NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections"
@jfversluis jfversluis merged commit 64ab1c3 into xamarin:5.0.0 Aug 25, 2021
@jfversluis
Copy link
Member

Thanks for your very first contribution @rotorgames ! You should be proud! ✨

rmarinho added a commit that referenced this pull request Sep 20, 2021
* Fix 4143: improved Span region calculation (#13348) fixes #4143 fixes #6992 fixes #11650 fixes #7655 fixes #11657 fixes #10520 fixes #4829 

* improved span region calculation on android

* Remove unused code

* Nit: clean up comments

* Wrap in ScrollView for small screen compatibility

Co-authored-by: Tim Dittmar <[email protected]>
Co-authored-by: Rachel Kang <[email protected]>
Co-authored-by: Rachel Kang <[email protected]>

* Only check for netfx when not in a wapproj (#14402) fixes #13957

* [macOS] Update Switch renderer (#14334) fixes #14313

* [macOS] Update Switch renderer #14313

* [macOS] Update Switch renderer #14313

* [Android] Fix to Issue Java.Lang.IndexOutOfBoundsException: setSpan (#12764) Fix to Issue #12762

* Update EntryRenderer.cs

Fix to Issue #12762
Java.Lang.IndexOutOfBoundsException: setSpan (nn ... nn) ends beyond length n-1

* Fix to EntryRenderer.cs

* Update EntryRenderer.cs

* Update EntryRenderer.cs

Co-authored-by: Rui Marinho <[email protected]>

* [Android] Fix ClearButton not working when changing the ClearButtonVisibility while the Entry field is focused (#13820) Fixes #13819

Co-authored-by: Javier Suárez <[email protected]>

* Automated dotnet-format update (#14404)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Automated dotnet-format update (#14405)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix memory leak (and some crashes) in ItemsViewController (iOS) (#14111)

* add unit test

* fix memory leak (and some crashes) in ItemsViewController (iOS)

* Update ItemsViewController.cs

Co-authored-by: Rui Marinho <[email protected]>

* Enable ScrollTo tests for Android, UWP; implement ScrollTo with group index for Android (#13007)

* Remove inaccurate category

* Enable ScrollTo tests for Android/UWP; Implement grouped ScrollTo for Android

* Implement missing ScrollTo grouped item by index

* Exempt 3788 test from UWP

* Ignore test on UWP

Co-authored-by: Rui Marinho <[email protected]>

* Fix type for case blueviolet (#14434)

The 'v' in this case was uppercase causing this typeconverter to reject BlueViolet as a valid color value. Fixes #AB1286706 [XVS]XLS0431: Invalid value for property 'BackgroundColor': 'BlueViolet'

* [iOS] Fix: CollectionView was not updating when it was invisible (#14384)

* [iOS] Fix: CollectionView was not updating when it was invisible

* [iOS] Fix: NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections in the collection view when NumberOfItemsInSection is invoked

* Revert "[iOS] Fix: NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections in the collection view when NumberOfItemsInSection is invoked"

This reverts commit 2343f15.

* [iOS] Fix: Prevent NumberOfItemsInSection invoking if CollectionView is hidded to avoid  "NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections"

* [iOS] Scroll locked issue using SwipeView (#12758)

* Fixed issue re-enabling the scroll

* Added repro sample

* Fixed also the swipe sensitive issue on iOS

Co-authored-by: Gerald Versluis <[email protected]>

* Fix removed shadow in Thumb setting a custom color (#13166)

* [iOS] Fix crash/closing wrong modal with FormSheet and tap outside (#14527)

* Add repro + fix

* Update Issue12300.cs

* [Core] SwipeItem Parent using SwipeView in DataTemplate (#13385)

* Added repro sample

* Fix the issue

Co-authored-by: Gerald Versluis <[email protected]>

* Fix Frame Background issue with transparent color (#14565)

* Fix broken disabled Button visual state in UWP (#14567)

Co-authored-by: Gerald Versluis <[email protected]>

* Update Device.Idiom when flipping tablet mode state (#13150)

* [Android] Fix occasional wrong touch interception in SwipeView Content  (#13732)

* Fix wrong touch interception in SwipeView Content on Android

* Updated swipe delta

* Fix Entry issue using TextColor and ClearButton in iOS < 13 (#14566)

Co-authored-by: Gerald Versluis <[email protected]>

* Fix issue using FormattedString and LineBreakMode on iOS (#14572)

Co-authored-by: Gerald Versluis <[email protected]>

* Align BarBackground behavior between Android and iOS. (#13503)

* Automated dotnet-format update (#14570)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [Android] Update gradients based on offset changes in Frame and BoxView (#11812)

* Update gradients based on offset changes in Frame and BoxView on Android

* Updated the sample to test also the BoxView Brush offsets

* Fix NRE in ListView Command validation (#14580)

* [iOS] Fix inability to check an initially disabled RadioButton after enabling it (#14545)

* Listen for updates to IsEnabled on RadioButton to ensure that the tap gesture recogniser is added when the control is enabled

* Update Issue14544.cs

* Update test case

Co-authored-by: Gerald Versluis <[email protected]>

* Fix crash navigating in Shell (#14577)

* Androidx bumps (#14506)

* Update to Latest Android X Libraries

* - fix android forwarders

* Moar updates

Co-authored-by: Gerald Versluis <[email protected]>

* Validate issue 14433 (#14576)

* Added repro sample

* Updated sample

Co-authored-by: Gerald Versluis <[email protected]>

* [iOS] Remove usage of System.Drawing types (#14571)

* Run nightly also for 5.0.0 branch

* Automated dotnet-format update (#14581)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Ordering children while adding (#8231)

* Ordering children while adding

* Abstract OrderElement

* Re-order on runtime child addition and Tests

* Runtime addition ensures Z Index

* Stop performance measurement on return

* Update VisualElementPackager.cs

Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Javier Suárez <[email protected]>

* If stroke is null avoid render a shape stroke (#14587)

* Fix broken Android platform tests (#14590)

* Automated dotnet-format update (#14595)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [macOS] Fix RadioButton activated behaviour (#14139)

* Respond to Activated event

* Set initial control state based on element state

* Revert "Set initial control state based on element state"

This reverts commit 1bd1238.

* CollectionView RemainingItemsThreshold implementation for UWP (#14202)

* [Android] Fix building with Android stable bits (#14608)

* Set java sdk path

* Use class-parse

Co-authored-by: Braini01 <[email protected]>
Co-authored-by: Tim Dittmar <[email protected]>
Co-authored-by: Rachel Kang <[email protected]>
Co-authored-by: Rachel Kang <[email protected]>
Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: MH Rastegari <[email protected]>
Co-authored-by: Felipe Silveira <[email protected]>
Co-authored-by: Rui Marinho <[email protected]>
Co-authored-by: Jonathan Goyvaerts <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Thomas Mijieux <[email protected]>
Co-authored-by: E.Z. Hart <[email protected]>
Co-authored-by: Marco Goertz <[email protected]>
Co-authored-by: Kirill <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Lee Millward <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: Filip Navara <[email protected]>
Co-authored-by: Shanmukha Ranganath <[email protected]>
Co-authored-by: Julio César Rocha <[email protected]>
Co-authored-by: nk221 <[email protected]>
@jfversluis jfversluis added maui-validated Issue/PR has been validated to not be an issue in .NET MAUI/PR has been opened/merged in .NET MAUI and removed needs-maui-validation labels Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maui-validated Issue/PR has been validated to not be an issue in .NET MAUI/PR has been opened/merged in .NET MAUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug][iOS] CollectionView filtering causes native crash
4 participants