Skip to content

ScrollView layout not updating when child IsVisible is updated #7322

Closed

Description

@paulvarache

Description

Using IsVisible on a descendent of a ScrollView doesn't update the ContentSize of the scroll view.

Only tested on Android. Reproduction repo: https://github.com/paulvarache/MauiIssueScrollViewLayout

In this example, the ScrollView still allows to scroll even after its content becomes smaller than its size

device-2022-05-19-091356.mp4

Steps to Reproduce

  1. Create a Maui App
  2. Size the ScrollView to be smaller than its content
  3. Programmatically update an View's IsVisible to make the content smaller than the scrollview

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 11

Did you find any workaround?

Calling Layout() on the scrollView with its parent bounds after changing the visibility of the child view

Relevant log output

No response

Activity

  1. added
    s/needs-verification
    t/bug
    on May 19, 2022
  2. added
    area-layout
    on May 19, 2022
  3. paulvarache commented on May 19, 2022

    @paulvarache
    Author

    It seems like calling Layout does not help. What makes the ScrollView layout properly is:

    scrollView.SetValue(VisualElement.HeightRequestProperty, 0); // Setting the value to scrollView.Height does not work
    await Task.Delay(1); // a delay of 0 does not work
    scrollView.ClearValue(VisualElement.HeightRequestProperty);

    Unfortunately, this causes a flash of the content

  4. added
    s/verified
    s/triaged
    and removed
    s/needs-verification
    on May 20, 2022
  5. XamlTest commented on May 20, 2022

    @XamlTest

    Verified this issue with Visual Studio Enterprise 17.3.0 Preview 2.0 [32515.61.main]. Repro on Android 11 with provided project.

  6. self-assigned this
    on May 20, 2022
  7. added this to the 6.0.300-servicing milestone on May 20, 2022
  8. jfversluis commented on Jul 6, 2022

    @jfversluis
    Member

    Verified this is fixed in our current code, this should be part of the next service release!

    Screen.Recording.2022-07-06.at.12.51.59.mov
  9. ghost locked as resolved and limited conversation to collaborators on Aug 5, 2022
  10. added and removed
    area-layout
    on May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-controls-scrollviewplatform/androids/triageds/verifiedt/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions