Skip to content

Commit

Permalink
Fix context config from withSizes
Browse files Browse the repository at this point in the history
  • Loading branch information
renatorib committed Jan 18, 2018
1 parent b691e36 commit 99dc834
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const getSizesFallback = userAgent => {

return {
fallbackWidth: 1280,
fallbackHeiht: 700,
fallbackHeight: 700,
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/withSizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import getDisplayName from './utils/getDisplayName'
import shallowDiff from './utils/shallowDiff'
import getWindowSizes from './utils/getWindowSizes'

import contextTypes from './contextTypes'
import contextTypes, { contextKey } from './contextTypes'
import * as presets from './presets'

const withSizes = (...mappedSizesToProps) => WrappedComponent => {
Expand All @@ -24,7 +24,8 @@ const withSizes = (...mappedSizesToProps) => WrappedComponent => {
super(props, context)

this.getWindowSizesWithFallback = () => {
const { fallbackHeight = null, fallbackWidth = null } = this.context
const config = this.context[contextKey] || {}
const { fallbackHeight = null, fallbackWidth = null } = config
return getWindowSizes({ fallbackHeight, fallbackWidth })
}

Expand Down

0 comments on commit 99dc834

Please sign in to comment.