-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add useTheme Hooks #48
Conversation
fun useTheme(): Theme { | ||
return useContext(themeContext) | ||
} | ||
|
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.
The Material-UI useTheme does a few other things, not sure if they are important, but just in case, maybe it should be like this instead:
@JsModule("@material-ui/core/styles/useTheme")
private external val useThemeDefault: dynamic
fun useTheme() = useThemeDefault.default()
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.
Why useTheme return dynamic instead of Theme
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.
Ops, yes that should be useTheme(): Theme
and to stop warnings...
@Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
fun useTheme(): Theme = useThemeDefault.default() as Theme
No description provided.