Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollView inside a dynamic Grid row won't completely scroll (iOS) #15288

Open
LukeFranky opened this issue May 26, 2023 · 6 comments
Open

ScrollView inside a dynamic Grid row won't completely scroll (iOS) #15288

LukeFranky opened this issue May 26, 2023 · 6 comments
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 t/bug Something isn't working
Milestone

Comments

@LukeFranky
Copy link

Description

If a ScrollView is positioned inside of a Grid row with a dynamic height (RowDefinition Height="*"), it cannot be scrolled completely to the bottom.

This was not a problem in previous versions. Yet to find a workaround.

Steps to Reproduce

  1. Create a new MAUI project (or use the repo).
  2. Wrap the ScrollView with a Grid.
  3. Add a RowDefinition with Height="100".
  4. Add a RowDefinition with Height="*".
  5. Set ScrollView Row="1".
  6. Run the application.
  7. Try to scroll to the bottom (The button will not stay visible).

Link to public reproduction project repository

https://github.com/LukeFranky/ScrollView-in-Grid-MAUI-Bug

Version with bug

7.0.86

Last version that worked well

7.0.81

Affected platforms

iOS

Affected platform versions

14.6

Did you find any workaround?

No response

Relevant log output

No response

@LukeFranky LukeFranky added the t/bug Something isn't working label May 26, 2023
@ritesh-burn
Copy link

Yes I'm seeing this as well. I've seen a similar issue with CollectionViews inside a Grid as well but it doesn't seem to be consistent.

@LukeFranky
Copy link
Author

LukeFranky commented May 26, 2023

@ritesh-burn here's my current workaround. It will only work if you have one dynamically sized row, not multiple.

Seems to be such a basic thing to be broken.

    private void TemplateGrid_SizeChanged(object sender, EventArgs e)
    {
        // Fix scroll height;
        double remainingHeight = this.TemplateGrid.Height;

        foreach (RowDefinition row in this.TemplateGrid.RowDefinitions)
        {
            if (row.Height.IsAbsolute)
            {
                remainingHeight -= row.Height.Value;
            }
        }

        this.ScrollArea.HeightRequest = remainingHeight;
    }

@omghb
Copy link

omghb commented May 26, 2023

Maybe this is about the same issue:

@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label May 26, 2023
@ritesh-burn
Copy link

Thanks @LukeFranky I will try it out. I also noticed that just setting the height to something arbitrary like CollectionView.MaximumHeightRequest = Grid.Height - 200; seems to work in most cases but still fails at times.

@faheys
Copy link
Contributor

faheys commented May 31, 2023

Same problem with both scroll views and collection views on iOS for me as well. Latest MAUI update (non preview) has completely borked almost everything that uses a grid and dynamic height/width values.

@ritesh-burn
Copy link

ritesh-burn commented May 31, 2023

I looked at the code changes that broke this and it looks like it will go back to previous behavior if the Grid's height is fixed. So if you have a grid that covers the full height of the screen, you can do something like this as a work around and it will work like before:

    protected override void OnAppearing()
    {
        base.OnAppearing();
        Grid.HeightRequest = DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density;
    }

YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants