Initially selected item in CollectionView isn't highlighted on iOS #14730
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
platform/iOS 🍎
s/duplicate 2️⃣
This issue or pull request already exists
t/bug
Something isn't working
Description
When the SelectedItem property in a CollectionView is defined before it is rendered, the SelectedItem isn't highlighted in the CollectionView in iOS when the CollectionView is first rendered. If I create a List of items, define a "Selected" property to point to one of those items then, bind the CollectionView's "SelectedItem" property to the "Selected" property, the item contained in "SelectedItem" is not highlighted when the List of items is rendered in the CollectionView. If I click on any item in the CollectionView, it becomes highlighted.
The code referenced in this report shows that the Selected property is set prior to the initial rendering of the the CollectionView, however, the SelectedItem isn't highlighted on iOS (it works on Android).
I attached a screenshot of an iPhone emulator demonstrating the problem.
Steps to Reproduce
When the app is started, item "2", is selected programmatically as shown in the text "This is he selected item: 2". However, item "2" isn't highlighted in the rendered CollectionView of items "1 2 3". If you click on any item, you'll see it is highlighted and the text below it shows the correct highlighted item.
Link to public reproduction project repository
https://github.com/fischberg/CollectionViewRepro
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.2
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: