Skip to content

Commit

Permalink
Merge pull request #669 from rofrischmann/useFela-props-with-theme
Browse files Browse the repository at this point in the history
pass theme with props when using useFela
  • Loading branch information
robinweser authored Feb 12, 2019
2 parents ebdab31 + 93e9e4c commit 628fc55
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 628fc55

Please sign in to comment.