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 in Grid cell multiple issues on iOS, Android and WinUI. #15076

Closed
Keflon opened this issue May 14, 2023 · 4 comments
Closed

ScrollView in Grid cell multiple issues on iOS, Android and WinUI. #15076

Keflon opened this issue May 14, 2023 · 4 comments
Labels
platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 s/duplicate 2️⃣ This issue or pull request already exists t/bug Something isn't working

Comments

@Keflon
Copy link

Keflon commented May 14, 2023

Description

Grid with RowDefinitions="*,*" where each grid cell contains a ScrollView ...

Scenario 1:

<Grid RowDefinitions="*,*">
    <ScrollView Grid.Row="0" >
        <Rectangle HeightRequest="500" BackgroundColor="Blue"/>
    </ScrollView>
    <ScrollView Grid.Row="1" >
        <Rectangle  HeightRequest="500" BackgroundColor="Yellow" />
    </ScrollView>
</Grid>
  1. Android: The Grid cells are 50/50 and the Rectangle can be scrolled within the ScrollView. (Pixel 5, Emulator)
  2. iOS: [BUG] The Grid cells expand to fit the Rectangle, i.e. they are too big. (iPhone SE, simulator)
  3. Windows: [BUG] The Grid cells appear to be the correct height but the Rectangles are minimal height.

Image 1.1
image

Image 1.2
image

Image 1.3
image

Scenario 2:

<Grid RowDefinitions="*,*">
    <ScrollView Grid.Row="0" >
        <Button Text="A Button in a ScrollView" HeightRequest="500" BackgroundColor="Blue"/>
    </ScrollView>
    <ScrollView Grid.Row="1" >
        <Button Text="A Button in a ScrollView" HeightRequest="500" TextColor="Blue" BackgroundColor="Yellow" />
    </ScrollView>
</Grid>
  1. Android: The Grid cells are 50/50 and the Buttons can be scrolled within the ScrollView.
    1. Android: [BUG] If this text has InputTransparent=True, it does not show.
  2. iOS: [BUG] The Grid cells expand to fit the Button, i.e.they are too big. (iPhone SE, simulator)
  3. Windows: [BUG] The Grid is 50/50, the Button is 500 in height, but the ScrollView is not scrollable.

Image 2.1
image

Image 2.2
image

Image 2.3

EDIT: The ScrollBars are present and work correctly. See the comment after this post.

image

Steps to Reproduce

File->New MAUI app.
Replace the root object in MainPage.xaml with one or the other Grid shown below ...

Scenario 1:

<Grid RowDefinitions="*,*">
    <ScrollView Grid.Row="0" >
        <Rectangle HeightRequest="500" BackgroundColor="Blue"/>
    </ScrollView>
    <ScrollView Grid.Row="1" >
        <Rectangle  HeightRequest="500" BackgroundColor="Yellow" />
    </ScrollView>
</Grid>
  1. Android: The Grid cells are 50/50 and the Rectangle can be scrolled within the ScrollView. (Pixel 5, Emulator)
  2. iOS: [BUG] The Grid cells expand to fit the Rectangle, i.e. they are too big. (iPhone SE, simulator)
  3. Windows: [BUG] The Grid cells appear to be the correct height but the Rectangles are minimal height.

Scenario 2:

<Grid RowDefinitions="*,*">
    <ScrollView Grid.Row="0" >
        <Button Text="A Button in a ScrollView" HeightRequest="500" BackgroundColor="Blue"/>
    </ScrollView>
    <ScrollView Grid.Row="1" >
        <Button Text="A Button in a ScrollView" HeightRequest="500" TextColor="Blue" BackgroundColor="Yellow" />
    </ScrollView>
</Grid>

Link to public reproduction project repository

https://github.com/Keflon/MauiGridBug

Version with bug

7.0 (current)

Last version that worked well

6.0.312

Affected platforms

iOS, Android, Windows, I was not able test on other platforms

Affected platform versions

Latest.

Did you find any workaround?

No workaround found yet.
The problem is new, but I didn't notice which update caused it. It was a recent update.

The disappearing text (when InputTransparent="True") for Android is visible if IsVisible is initially true, i.e. not databound to a bool that starts false.
There are many other 'quirks' to the layout, some of which may be symptoms of the same underlying problem. These caused some difficulty providing a succinct demo project.

Maybe this is a clue? ...
The problem that led me here is a WinUI problem where it appears resizing the width of the Window causes a layout pass that sorts out some grid-related layout issues I was having, at the cost of causing other issues. I'm being vague because I'm not certain whether the problem lies with me; if not, I'll raise a bug if I don't find an existing one.
The problems all centre around a custom-control that contains a ScrollView.

Relevant log output

No response

@Keflon Keflon added the t/bug Something isn't working label May 14, 2023
@Keflon
Copy link
Author

Keflon commented May 14, 2023

No workaround found yet.

  • Setting an explicit height on the Grid cells dodges the problem where cells are too big.

Bugfix:

  • The sample had a Label in the foreground with InputTransparent=True yet it consumed input and prevented the ScrollView from scrolling.

I have minimised the label size in the repo so it doesn't get in the way.

Updates to scenario 2 after point 2 was applied:
- Windows: [BUG] The Grid is 50/50, the Button is 500 in height, but the ScrollView is not scrollable.
The ScrollView is scrollable.

All other bugs are as described above.

@drasticactions
Copy link
Contributor

drasticactions commented May 14, 2023

Can you split these bugs into separate issues with separate solutions? I appreciate what you wrote, but it's hard for me to understand your exact problem by going back and looking at these drawings pointing to things. Likewise, having one "uber" bug makes it harder to fix and close.

@Keflon
Copy link
Author

Keflon commented May 14, 2023

Apologies, I can see this report is messy. I was in a rush and whilst writing the minimum repo I ran into the Rectangle and Button
behaving differently, and then InputTransparent not working on all platforms.

The bug I was trying to report is simply this:

  • If an auto-sized gridrow has a ScrollView as the root element, the layout is wrong in different ways for WinUI and iOS.
    • The 'wrong' is also different depending on the control inside the ScrollView, as demonstrated by the 2 xaml snippets.

Unless you tell me that clears things up I'll create the following bugs reports, each with separate repos:

  1. iOS bug. Auto-sized Grid row containing ScrollView sizes itself to the full height requested by the ScrollView content.
  2. WinUI bug. Auto-sized Grid row containing ScrollView containing a Rectangle ignores explicit HeightRequest on the Rectangle. (and perhaps other controls, but not all)

Please note there are probably more symptoms of the underlying bug, e.g. I've got grid-cells resizing themselves vertically on WinUI when the Window is resized horizontally. I just don't have time to write up everything I run into. Wish I did.

  1. I'll write up the 2 InputTransparent problems separately as 2 separate bugs. (doesn't work / can hide a label)

Before I write these up, can you let me know if that's what you're asking for, and perhaps save me some time if you're aware of these problems already being reported?

Please feel free to close this bug once you have replied.

@Keflon Keflon closed this as completed May 15, 2023
@samhouts samhouts added the s/duplicate 2️⃣ This issue or pull request already exists label May 15, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 s/duplicate 2️⃣ This issue or pull request already exists t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants