Bug 52639 - ListView and SearchBar do not get along
Summary: ListView and SearchBar do not get along
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
Depends on:
Reported: 2017-02-21 03:32 UTC by Kent
Modified: 2017-11-28 19:39 UTC (History)
5 users (show)

Tags: searchbar activityindicator listview
Is this bug a regression?: ---
Last known good build:

Repro (149.06 KB, application/x-zip-compressed)
2017-02-21 03:32 UTC, Kent

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 52639 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Kent 2017-02-21 03:32:42 UTC
Created attachment 19888 [details]

I've been struggling with an issue in our app where a ListView will render perfectly with one set of data, but then it will be "cut off" at the top when the data changes. The user can still pull down to see the top bit of data, but it's as if it doesn't understand where it's content begins anymore.

Trying to reproduce this in a standalone project was a nightmare because it seems to rely on a specific combination of controls, properties, and events. But I think I've narrowed this down about as well as I can. Basically, if the ListView is updated in response to a non-empty query inside a SearchBar, it's fine. But if the SearchBar is cleared and the data is updated in response to the clearing, things go awry. This is true only if one attempts to show the refresh indicator throughout.

Don't believe me? I don't expect you to. I've attached a repro to demonstrate. Here's what you need to do:

1. Download and open the solution
2. Run it up on iOS
3. Hit the Search button. Observe that the indicator is shown correctly and data is populated.
4. Pull up and down on the list and observe that it all looks good.
5. Enter some text in the SearchBar and hit enter. Observe that the indicator is NOT shown (though space is made for it) and that the results do not collapse back again when the data populates
6. Pull down on the list and observe that the data jumps back up, but too far. The list is now "cut off"
7. Perform another data population by clicking the button again. The list now rights itself *until you pull down again*. When you do so, it's cut off again.
8. Clear the search. Data is populated again, but is still cut off.
9. Hit the search button again. Everything is back to normal!

So it seems to be some combination of:

1. The use of the SearchBar (having some text in it, or instigating the search from it)
2. The display of the refresh indicator (which does not work reliably per above, and is possibly a separate bug)
Comment 1 Paul DiPietro [MSFT] 2017-02-21 22:33:43 UTC
Thank you for the reproduction. It also occurs against the nightly build. I'm going to set this to confirmed for now.
Comment 2 Mat 2017-11-28 19:39:52 UTC
Occurs for ours apps also. To try and find solutions we tried to replace the SearchBar with Entry and we are still able to reproduce the issue. 

With an Entry instead of a searchbar, we have to perform a pull-down-to-refresh to reproduce it.