Skip to content
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

[Request] Isolate theme and colours to a react hook, allowing for light/dark theming #1879

Open
sergioisidoro opened this issue Feb 8, 2022 · 0 comments
Assignees
Labels
cookbook 🧑‍🍳 A request on how a specific library or pattern would be implemented within an Ignite project enhancement
Milestone

Comments

@sergioisidoro
Copy link
Contributor

I'm working on an app with a dark and light theme. It's, I believe, a fairly common pattern nowadays.
I've found that having a react Hook to be a good approach.

import { useTheme } from '../hooks/';

const makeRootStyles(colors: any): ViewStyle => {
  return {
    backgroundColor: colors.black,
    flex: 1,
  }
}

const Component ....
   const { colors } = useTheme();
   const componentStyles = makeRootStyles(colors)

  return (
    <Screen style={componentStyles} preset="scroll">
      <Text preset="header" text="home" />
    </Screen>

However, if we do that, we lose many of the advantages of the generators, which import directly from the constants.

I'm wondering if there would be a way to implement variable theming with the ignite templates, without losing the advantages of the super helpful generators. Or if it is in the roadmap to isolate the colours / themes into a hook.

@yulolimum yulolimum added this to the Maverick: Ignite v8.0 milestone Jul 21, 2022
@yulolimum yulolimum self-assigned this Jul 21, 2022
@jamonholmgren jamonholmgren added the maverick Ignite v8: Maverick label Jul 22, 2022
@jamonholmgren jamonholmgren added enhancement and removed maverick Ignite v8: Maverick labels Aug 31, 2022
@jamonholmgren jamonholmgren removed this from the Ignite v8: Maverick milestone Aug 31, 2022
@joshuayoes joshuayoes added cookbook 🧑‍🍳 A request on how a specific library or pattern would be implemented within an Ignite project and removed in progress labels Oct 4, 2022
@frankcalise frankcalise added this to the Ignite v10 milestone Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cookbook 🧑‍🍳 A request on how a specific library or pattern would be implemented within an Ignite project enhancement
Projects
None yet
Development

No branches or pull requests

5 participants