Open quocluongha opened 6 months ago
According to document: here, the only way I can access theme specific tokens is to use styled wrapper function. It would be nice if the library export a hook to retrieve theme object by name.
styled
For example:
// gluestack-ui.config.ts const config = createConfig({ theme: { themeA: {...}, themeB: {...} } }) // later on other files const themeA = useThemeObject("themeA") // <-- Retrieve themeA object const themeB= useThemeObject("themeB") // <-- Retrieve themeB object
I think this feature will save a lot of time for styling components that have deeply nested style props like:
<Component options={{ containerStyle: {...}, contentStyle: {...} , }} />
I also try to use Property Resolver, but the resolver is only support one token type like colors or fonts.
colors
fonts
The hook somehow works like Tamagui useTheme
useTheme
No response
Hey @quocluongha , Thanks for reporting the issue. We will have a look.
Has it been fixed yet?
Description
Description
According to document: here, the only way I can access theme specific tokens is to use
styled
wrapper function. It would be nice if the library export a hook to retrieve theme object by name.For example:
Problem Statement
I think this feature will save a lot of time for styling components that have deeply nested style props like:
I also try to use Property Resolver, but the resolver is only support one token type like
colors
orfonts
.Proposed Solution or API
The hook somehow works like Tamagui
useTheme
Alternatives
No response
Additional Information
No response