Skip to content

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

Open
@munkii

Description

@munkii

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresentermigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertp/2Work that is important, but is currently not scheduled for releaseplatform/android 🤖potential-regressionThis issue described a possible regression on a currently supported version., verification pendings/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions