-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[modules-core] add convertible support for PlatformColor
and DynamicColorIOS
#26724
Conversation
Looks like the CI is green except for these two steps:
Both fail with:
@tsapeta does this need a fix? |
Hey @dlindenkreuz! Thanks so much for submitting such a great PR! I'll review it today. You can ignore these CI jobs, looks like an issue on our side because forks have no access to repo secrets - to be honest we shouldn't even run them on external contributions 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, I left just a few nitpicks 😄
packages/expo-modules-core/ios/Core/Convertibles/Convertibles+Color.swift
Outdated
Show resolved
Hide resolved
packages/expo-modules-core/ios/Core/Convertibles/Convertibles+Color.swift
Outdated
Show resolved
Hide resolved
packages/expo-modules-core/ios/Core/Convertibles/Convertibles+Color.swift
Outdated
Show resolved
Hide resolved
packages/expo-modules-core/ios/Core/Convertibles/Convertibles+Color.swift
Show resolved
Hide resolved
packages/expo-modules-core/ios/Core/Convertibles/Convertibles+Color.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks again for this improvement! Are you interested in implementing this for Android too? We can give you some guidance on it 😉
PlatformColor
and DynamicColorIOS
PlatformColor
and DynamicColorIOS
Phew, I have never built anything for Android before so I have no idea about the platform… At the latest, I'll get back to this when my project reaches the Android part 😜 |
@brentvatne I am using How can I use this in my project? |
Hi @dlindenkreuz, This PR was merged after the SDK 50 was released, that is after the release branch was cut off, so normally it would be released in SDK 51. We usually don't backport new features to already released SDKs, but since this change seems to be safe to release with SDK 50, I just cherry-picked your commit to that branch, so it will be published in |
Why
PlatformColor
andDynamicColorIOS
are currently not supported by expo-modules-core.Packages based on Expo Modules should be able to use colors that are resolved at runtime, allowing for Dark Mode adjustments and system colors. React Native has supported this since a while upstream and it's time to bring this to Expo Modules as well.
Important: This PR only adds support for iOS. It looks like
ColorPropConverter
needs to be called from Expo but I have no experience with the Android platform.How
Convertibles+Color.swift
RCTConvert
implementationUIColor
class vars likeUIColor.systemRed
never return an array in Swift → noNSArray
handler requiredTest Plan
ConvertiblesSpec.swift
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).