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

Updating a Border.TranslationY does not work in Android #24818

Open
munkii opened this issue Sep 18, 2024 · 7 comments · May be fixed by #25760
Open

Updating a Border.TranslationY does not work in Android #24818

munkii opened this issue Sep 18, 2024 · 7 comments · May be fixed by #25760
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert p/2 Work that is important, but is currently not scheduled for release platform/android 🤖 potential-regression This issue described a possible regression on a currently supported version., verification pending s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@munkii
Copy link
Contributor

munkii commented Sep 18, 2024

Description

We have a custom "BottomSheetControl" implemented in Xamarin Forms that works in both iOS and Android. We are portiung it and the rest of the App to MAUI.

I have a repro of the issue in this git repo, https://github.com/munkii/MauiAppBottomSheetIssue

The only change we have made to it is that we have swuicthed from using a Frame to a Border for the elment named "Sheet". This problem existed in MAUI even with Frame.

When the Sheet is "opened" we update the TranslationY. We were animating the value but for the sake of simplicitly during this debugging process I have switched to setting directly.

public async Task OpenSheet(double? position = null)
{
    System.Diagnostics.Debug.WriteLine("BottomSheetControl.OpenSheet " + position);

    if (position.HasValue == false)
    {
        position = 0;
    }

    ////await Task.WhenAll(
    ////    this.Backdrop.FadeTo(0.4, length: BottomSheetControl.SheetAnimationDuration),
    ////    this.Sheet.TranslateTo(0, position.Value, length: BottomSheetControl.SheetAnimationDuration, easing: Easing.SinIn));

    this.Backdrop.Opacity = 0.4;
    this.Sheet.TranslationY = position.Value;

    this.BottomSheetContentView.InputTransparent = this.Backdrop.InputTransparent = false;
}

This approach works fine on an iOS device but in Android the content that has been translated up is not visible. If you navigate to the Border via "Live Visual Tree" you can see that it's TranslateY is 0 as expected.

Screenshot_Before_PropertyEdit

If you edit the TranslateY to 1 (or any value) the content is immediatly available, if you set it back to 0 it is still fine.

Screenshot_After_PropertyEdit

It's as if the Border needs a signal to repaint

Steps to Reproduce

Using the linked repro you can see that the Label in the grid is displayed when you press "Click me" in iOS. Pressing anywhere outside of the Label will cause it to animate away.

Try the same thing in Android and the Label is not visible. Until you fiddle with the TranslateY via the Live Property explorer

Link to public reproduction project repository

https://github.com/munkii/MauiAppBottomSheetIssue

Version with bug

8.0.82 SR8.2

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

No response

@munkii munkii added the t/bug Something isn't working label Sep 18, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@tj-devel709 tj-devel709 added platform/android 🤖 potential-regression This issue described a possible regression on a currently supported version., verification pending p/2 Work that is important, but is currently not scheduled for release area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter labels Sep 18, 2024
@tj-devel709 tj-devel709 added this to the Backlog milestone Sep 18, 2024
@kevinxufei kevinxufei added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert labels Sep 19, 2024
@kevinxufei
Copy link

kevinxufei commented Sep 19, 2024

I can repro this issue at Android platform on the latest 17.12.0 Preview 2.0(8.0.90 & 8.0.82 & 8.0.80).

@FM1973
Copy link

FM1973 commented Oct 18, 2024

I got the same problem.
@munkii Did you find a solution or a workaround?

@munkii
Copy link
Contributor Author

munkii commented Oct 18, 2024

No I haven't I'm just waiting for a fix.

We are currently porting an existing XF app so for now we just keep maintaining both until we have a shippable MAUI version

@kubaflo
Copy link
Contributor

kubaflo commented Nov 7, 2024

Hi @munkii, try to put BottomSheetContentView.InputTransparent = false before Sheet.TranslationY = position.Value;

@FM1973
Copy link

FM1973 commented Nov 7, 2024

I also stumbled across it by chance yesterday. It works, although the connection is not clear to me.

@munkii
Copy link
Contributor Author

munkii commented Nov 7, 2024

Hi @munkii, try to put BottomSheetContentView.InputTransparent = false before Sheet.TranslationY = position.Value;

That definetly works. How did you discover that and do you know why that works?

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 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert p/2 Work that is important, but is currently not scheduled for release platform/android 🤖 potential-regression This issue described a possible regression on a currently supported version., verification pending s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants