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

[Bug] FirstVisibleItemIndex and LastVisibleItemIndex is wrong of CollectionView's Scrolled Event's ItemsViewScrolledEventArgs in iOS #11695

Closed
JavedAppdevelopment opened this issue Aug 7, 2020 · 1 comment
Labels
s/unverified New report that has yet to be verified t/bug 🐛

Comments

@JavedAppdevelopment
Copy link

Description

When a CollectionView Scrolled events fired in ios, Even'ts ItemsViewScrolledEventArgs.FirstVisibleItemIndex and ItemsViewScrolledEventArgs.LastVisibleItemIndex is wrong. It works fine in Android but provide -2 for the FirstVisibleItemIndex then it is actually and +2 for the LastVisibleItemIndex. On Initial Phase it provide correct value for FirstVisibleItemIndex (e.g; is 0) but + for the LastVisibleItemIndex. once you scoll to up it start providing incorrect index for FirstVisibleItemIndex as well.

Here I provided a sample application which shows the number in collection view starting with 0 and can be between 30 to 50 randomly. At the bottom of the page, it has two labels which show the first visible item index and last visible item index respectively.

Steps to Reproduce

  1. Run the application iOS device or simulator.
  2. Scroll up 0 and 1 until the 2 becomes the first visible item and note the First Visible Item Index, It is still 0 even if first two items are not displayed anymore now (Bug, it should be 2).
  3. Also, note the Last Visible Item Index, It will be +2 then the last item displayed on the screen. (e.g; it will be 20 if Last visible item is 18).

Expected Behavior

The FirstVisibleItemIndex and LastVisibleItemIndex should be provide correct result.

Actual Behavior

Both FirstVisibleItemIndex and LastVisibleItemIndex provides -2 for the FirstVisibleItemIndex and +2 for the LastVisibleItemIndex then the actual visible item index on the screen.

Basic Information

  • Version with issue: 4.5.0.495
  • Last known good version:
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • iOS: 13.6
  • Nuget Packages: Xamarin.Forms and Xamarin.Essentials.
  • Affected Devices: All the ios devices

Screenshots

Simulator Screen Shot - iPhone 11 - 2020-08-07 at 22 39 23
Simulator Screen Shot - iPhone 11 - 2020-08-07 at 22 39 45

Reproduction Link

Please download the attached project and run it on ios simulator.

CollectionViewVisibleIndexTest.zip

@JavedAppdevelopment JavedAppdevelopment added s/unverified New report that has yet to be verified t/bug 🐛 labels Aug 7, 2020
@samhouts samhouts added this to New in Triage Aug 7, 2020
@PureWeen
Copy link
Contributor

PureWeen commented Aug 8, 2020

duplicate #9989

@PureWeen PureWeen closed this as completed Aug 8, 2020
Triage automation moved this from New to Closed Aug 8, 2020
@samhouts samhouts removed this from Closed in Triage Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants