Skip to content

Commit

Permalink
pass theme with props when using useFela
Browse files Browse the repository at this point in the history
  • Loading branch information
rofrischmann committed Feb 11, 2019
1 parent 05e0b56 commit 93e9e4c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/react-fela/src/useFela.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ type HookInterface = {

export default function useFela(props: Object = {}): HookInterface {
const renderer = useContext(RendererContext)
const theme = useContext(ThemeContext)
const theme = useContext(ThemeContext) || {}

const propsWithTheme = {
...props,
theme,
}

function css(...rules: Array<Object | Function>) {
return renderer.renderRule(combineRules(...rules), props)
return renderer.renderRule(combineRules(...rules), propsWithTheme)
}

return {
Expand Down

0 comments on commit 93e9e4c

Please sign in to comment.