FreakyAli / Maui.FreakyControls

FreakyControls is a free OSS UI Kit for .NET MAUI which provides a set of controls and utilities to build modern mobile apps.
MIT License
313 stars 37 forks source link

[Android][FreakyTextInputLayout] - TransitionToTitle doesn't animate on page load #146

Closed sk1llsh0t closed 1 month ago

sk1llsh0t commented 1 month ago

Description

On Android 12 (device i'm currently testing with), Android automatically puts focus on the first field on the page. This happens before the page is fully loaded/visible which prevents the animation/positioning of the placeholder to title transition animation from happening. the title font is resized but it remains in the middle of the entry. Typing in the entry doesn't "reanimate" the title since it is supposed to already be at the top of the control.

Code

This code is place inside a contentview. EmployeeId automatically gets focus when app loads.

<VerticalStackLayout
        Padding="30,0"
        Spacing="25">           

        <freakyControls:FreakyTextInputLayout x:Name="EmployeeId" Title="Employee #"
                                              BorderCornerRadius="10"
                                              Loaded="EmployeeId_OnLoaded"
                                              Text="{Binding Username}"
                                              ReturnType="Next"
                                              BorderType="Outlined"
                                              FontSize="20"
                                              TitleFontSize="14" />

        <freakyControls:FreakyTextInputLayout x:Name="Password" Title="Password"
                                              BorderCornerRadius="10"
                                              Text="{Binding Password}" 
                                              IsPassword="True"
                                              ReturnType="Done"
                                              BorderType="Outlined"
                                              FontSize="20"
                                              TitleFontSize="14" />

        <Button
            x:Name="btnLogin"
            Style="{DynamicResource ODPrimaryButton}"
            Command="{Binding LoginCommand}"
            Text="Login" 
            HorizontalOptions="Fill" />
    </VerticalStackLayout>

Expected Behavior

The title label should be placed above the entry field

Actual Behavior

The title remains over top of the entry field

sk1llsh0t commented 1 month ago

I was able to come up with a solution to this issue. I created a pull request (https://github.com/FreakyAli/Maui.FreakyControls/pull/147). Please include in your next build. Thanks!

FreakyAli commented 1 month ago

@sk1llsh0t Sure man thanks you are amazing!!!