CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
https://learn.microsoft.com/dotnet/communitytoolkit/maui
MIT License
2.24k stars 390 forks source link

[BUG] Snackbar displays incorrect text color on android and iOS app #2286

Open ravi032 opened 3 days ago

ravi032 commented 3 days ago

Is there an existing issue for this?

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

I use MAUI community toolkit Snackbar control to display message. I have set snackbar text color to white but on screen, it shows a shade of red.

Code sample -

var snackbarOptions = new SnackbarOptions
            {
                BackgroundColor = Color.FromArgb("#D5092E"),
                TextColor = Color.FromArgb("#FFFFFF"),
                ActionButtonTextColor =  Color.FromArgb("#FFFFFF"),
                CornerRadius = new CornerRadius(20),
                Font = Microsoft.Maui.Font.SystemFontOfSize(16),
                ActionButtonFont = Microsoft.Maui.Font.SystemFontOfSize(16),
                CharacterSpacing = 0
            };

            TimeSpan duration = TimeSpan.FromSeconds(timeoutSeconds);

            var snackbar = Snackbar.Make(message, action, actionTitle, duration, snackbarOptions);

            await snackbar.Show(default);

Output - Image

Expected Behavior

Snackbar should show the exact color set in the code. In my case, white color.

Steps To Reproduce

Please use this sample code to show snackbar on either android or ios app.

Code sample -

var snackbarOptions = new SnackbarOptions
            {
                BackgroundColor = Color.FromArgb("#D5092E"),
                TextColor = Color.FromArgb("#FFFFFF"),
                ActionButtonTextColor =  Color.FromArgb("#FFFFFF"),
                CornerRadius = new CornerRadius(20),
                Font = Microsoft.Maui.Font.SystemFontOfSize(16),
                ActionButtonFont = Microsoft.Maui.Font.SystemFontOfSize(16),
                CharacterSpacing = 0
            };

            TimeSpan duration = TimeSpan.FromSeconds(timeoutSeconds);

            var snackbar = Snackbar.Make(message, action, actionTitle, duration, snackbarOptions);

            await snackbar.Show(default);

Output - Image

Link to public reproduction project repository

NA

Environment

Anything else?

No response

dotnet-policy-service[bot] commented 2 days ago

Hi @ravi032. We have added the "needs reproduction" label to this issue, which indicates that we cannot take further action. This issue will be closed automatically in 5 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ravi032 commented 2 days ago

Steps to reproduce is,

  1. Create a MAUI project
  2. Add the community toolkit nugget package
  3. On the main page, add a button and click event
  4. In the click event, add the snacker code shared above
  5. This would show snacker.

In the code you can see that, text colour is set as white (#FFFFFF). however, when snackbar is shown, text colour is "#F9DEE#". You can verify this from the screenshot shared before.

bijington commented 2 days ago

@ravi032 the link next to the second checkbox you see when opening an issue explains that we ask for a sample to reproduce the issue and why we ask for one.

Sometimes it is possible to reproduce the issue in our sample application, if you can then that makes it easier for everyone. Can you try that please?