-
-
Notifications
You must be signed in to change notification settings - Fork 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
fix: Allow to use PlatformColor
in the theme
#11570
Conversation
Codecov ReportPatch and project coverage have no change.
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #11570 +/- ##
=======================================
Coverage 75.60% 75.60%
=======================================
Files 194 194
Lines 5783 5783
Branches 2275 2275
=======================================
Hits 4372 4372
Misses 1364 1364
Partials 47 47
☔ View full report in Codecov by Sentry. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
5cbf026
to
c033310
Compare
c033310
to
b97b57b
Compare
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.
Hi,
Thanks for your PR. Please, next time provide a deeper description of your changes. I didn't understand initially how that change basically "propagates" from rn-screens :)
here is more deeper description #11528 |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Hey, @retyui I'm sorry I have to revert this PR #11576. The concern, which I didn't notice earlier is that as some places (at example/src/Screens/NativeStackHeaderCustomization.tsx) you need to down-cast PlatformColor. Let me think about that. It's actually quite common practice to use strings as colors and we don't want to break the code for our current users (it's small, but it's somehow breaking change). I wonder, maybe we should introduce that together with some major as it's conceptually correct approach. |
right in time when I did a tweet lol) @osdnk you don't need to worry about |
Hi @retyui
Is there a way we can support those kind of manipulations? Also, why do you need this change? Maybe understanding this motivation would help us to find out a good solution. |
From our use case, we are trying to use The way we can support the manipulation using Color is by checking |
I did this workaround to use import { resolveColorSync } from "@klarna/platform-colors";
......
const scheme = useColorScheme();
const theme = useMemo(() => {
const navigationThemeColors = {
primary: resolveColorSync(Colors.primary),
background: resolveColorSync(Colors.background),
card: resolveColorSync(Colors.background),
text: resolveColorSync(Colors.primary),
border: resolveColorSync(Colors.background),
notification: resolveColorSync(Colors.primary),
};
return {
...(scheme === "dark" ? DarkTheme : DefaultTheme),
colors: {
...(scheme === "dark" ? DarkTheme.colors : DefaultTheme.colors),
...navigationThemeColors,
}
};
}, [scheme]);
...........
// pass theme
<NavigationContainer theme={theme}> Edit: |
Alternatively, if you don't rely on our colors' manipulations, you can simply ignore TS error |
Fix: #11481