unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.07k stars 735 forks source link

[Android] TextBox with TranslateTransform show incorrect system menus #1993

Open jeromelaban opened 5 years ago

jeromelaban commented 5 years ago

Current behavior

System menus of a translated TextBox are placed incorrectly.

<TextBox 
    TextWrapping="Wrap"
    AcceptsReturn="True"
    PlaceholderText="Text Message"
    VerticalAlignment="Center"
    Margin="0,0,44,0">
    <TextBox.RenderTransform>
        <TranslateTransform Y="-50"/>
    </TextBox.RenderTransform>
</TextBox>

Expected behavior

How to reproduce it (as minimally and precisely as possible)

Notice that the system menu is not at the correct position:

image

Environment

Nuget Package: 2.0.512-dev.3644

Affected platform(s):

Visual Studio:

Relevant plugins:

Anything else we need to know?

https://nventive.visualstudio.com/Umbrella/_workitems/edit/164383

davidjohnoliver commented 5 years ago

This is a tricky one. The positioning logic calls internal methods we can't override (which don't take getChildStaticTransformation() into account). It also seems to be heavily version-dependent: if I override the GetLocationInWindow() and GetGlobalVisibleRect() methods on TextBoxView, it 1) fixes the problem on an Android 6 device, 2) fixes the copy-paste toolbar but not the selection markers on an Android 7 device, and 3) doesn't fix either problem on an Android 8.1 device.

MatFillion commented 4 years ago

@davidjohnoliver @jeromelaban as this one seems pretty complex, can we suggest an alternative approach for someone who would like to translate a textbox? Since using TranslateTransform causes issues.

jeromelaban commented 4 years ago

I some options: