-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Views don’t default to native attributes #22665
Comments
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:
|
This issue is similar to #17414. The other issue lists Windows as the affected platform and gives an example of a Windows corner radius. This issue lists all platforms as likely affected and gives examples of iOS font size and color. |
Are you able to test with Xcode and Objective C? I think the Swift UI styles are not the default styles but rather the new Swift UI team's implementation of the default styles. |
Hi @breyed. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 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. |
I created a new app in Xcode using Storyboard (UIKit) for the interface. I added to the storyboard enabled and disabled buttons, leaving all attributes at their defaults. I did this with both Swift and Objective C. Regardless of the language, the colors are identical to the SwiftUI app’s colors. iOS 13 added support for both dark mode and SwiftUI. With dark mode support, Apple added colors that vary based on light/dark mode. SwiftUI and UIKit both tap into those.
|
https://github.com/drasticactions/MauiRepros/tree/main/AppleColors I wrote four test apps: One in SwiftUI, One in Swift/UIKit, One in MAUI, One with .NET iOS directly with no MAUI UI Toolkit. These screenshots were taken with the iPhone 15 Pro simulator. If you compare the Swift app with Swift UI one, you'll have the same Hex values for the colors. Likewise with Dark mode. The Swift (Non SwiftUI) colors match up with the XAML values, and the .NET iOS C# ones. Likewise with font sizes. If you want to compare the defaults in UIKit with what's in MAUI, IMO, your best bet is not using SwiftUI to do it. |
Description
Even though MAUI builds off a long tradition of “build a native UI”, by default its views differ from native platform views. MAUI should not override the platform defaults, but instead let the platform render them natively if not overridden by user code.
For example, when no style or attribute is applied to the color of a Label, Button, or other view, the platform’s native colors are not used. It’s as if something at startup is setting the colors to non-native defaults. The same applies to other attributes such as size and padding.
Internally, the attributes should default to no value, which should tell the handlers not set a value on the platform view. If a getter is called on a property such as color, its value should be read from the native platform.
Steps to Reproduce
dotnet new
and Xcode templates.Link to public reproduction project repository
No response
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
Tested on iOS 17. Likely affects all platforms and versions.
Did you find any workaround?
You’d could create the styles yourself and then aligned with platform changes, in theory including variants for downlevel native defaults. Alternatively, you could create custom startup code to query the platform’s native defaults and creating styles accordingly.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: